Exemple #1
0
 @Override
 public void setupModule(SetupContext context) {
   if (_serializers != null) {
     context.addSerializers(_serializers);
   }
   if (_deserializers != null) {
     context.addDeserializers(_deserializers);
   }
   if (_keySerializers != null) {
     context.addKeySerializers(_keySerializers);
   }
   if (_keyDeserializers != null) {
     context.addKeyDeserializers(_keyDeserializers);
   }
   if (_abstractTypes != null) {
     context.addAbstractTypeResolver(_abstractTypes);
   }
   if (_valueInstantiators != null) {
     context.addValueInstantiators(_valueInstantiators);
   }
   if (_subtypes != null && _subtypes.size() > 0) {
     context.registerSubtypes(_subtypes.toArray(new NamedType[_subtypes.size()]));
   }
   if (_mixins != null) {
     for (Map.Entry<Class<?>, Class<?>> entry : _mixins.entrySet()) {
       context.setMixInAnnotations(entry.getKey(), entry.getValue());
     }
   }
 }
 @Override
 public void setupModule(SetupContext context) {
   MongoAnnotationIntrospector annotationIntrospector =
       new MongoAnnotationIntrospector(context.getTypeFactory());
   context.insertAnnotationIntrospector(annotationIntrospector);
   // Only include non null properties, this makes it possible to use
   // object templates for querying and
   // partial object retrieving
   context.addDeserializationProblemHandler(new ServerErrorProblemHandler());
   context.addSerializers(new TweakedMongoJackSerializers());
   context.addDeserializers(new TweakedMongoJackDeserializers());
   context.addDeserializers(new MongoJackDeserializers());
   context.addAbstractTypeResolver(new CustomAbstractTypeResolver());
 }