Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   package com.fasterxml.jackson.databind;
   
   import java.io.*;
   import java.net.URL;
   import java.text.DateFormat;
   import java.util.*;
   
This mapper (or, data binder, or codec) provides functionality for converting between Java objects (instances of JDK provided core classes, beans), and matching JSON constructs. It will use instances of com.fasterxml.jackson.core.JsonParser and com.fasterxml.jackson.core.JsonGenerator for implementing actual reading/writing of JSON.

The main conversion API is defined in com.fasterxml.jackson.core.ObjectCodec, so that implementation details of this class need not be exposed to streaming parser and generator classes.

Note on caching: root-level deserializers are always cached, and accessed using full (generics-aware) type information. This is different from caching of referenced types, which is more limited and is done only for a subset of all deserializer types. The main reason for difference is that at root-level there is no incoming reference (and hence no referencing property, no referral information or annotations to produce differing deserializers), and that the performance impact greatest at root level (since it'll essentially cache the full graph of deserializers involved).

  
  public class ObjectMapper
      extends ObjectCodec
      implements Versioned,
          java.io.Serializable // as of 2.1
  {
      private static final long serialVersionUID = 1L;
  
      /*
      /**********************************************************
      /* Helper classes, enums
      /**********************************************************
       */

    
Enumeration used with ObjectMapper.enableDefaultTyping() to specify what kind of types (classes) default typing should be used for. It will only be used if no explicit type information is found, but this enumeration further limits subset of those types.
  
      public enum DefaultTyping {
        
This value means that only properties that have java.lang.Object as declared type (including generic types without explicit type) will use default typing.
  
          JAVA_LANG_OBJECT,
        
        
Value that means that default typing will be used for properties with declared type of java.lang.Object or an abstract type (abstract class or interface). Note that this does not include array types.
  
          OBJECT_AND_NON_CONCRETE,

        
Value that means that default typing will be used for all types covered by OBJECT_AND_NON_CONCRETE plus all array types for them.
  
          NON_CONCRETE_AND_ARRAYS,
        
        
Value that means that default typing will be used for all non-final types, with exception of small number of "natural" types (String, Boolean, Integer, Double), which can be correctly inferred from JSON; as well as for all arrays of non-final types.
 
         NON_FINAL
     }

    
Customized com.fasterxml.jackson.databind.jsontype.TypeResolverBuilder that provides type resolver builders used with so-called "default typing" (see ObjectMapper.enableDefaultTyping() for details).

Type resolver construction is based on configuration: implementation takes care of only providing builders in cases where type information should be applied. This is important since build calls may be sent for any and all types, and type information should NOT be applied to all of them.

 
     public static class DefaultTypeResolverBuilder
         extends StdTypeResolverBuilder
         implements java.io.Serializable
     {
         private static final long serialVersionUID = 1L;

        
Definition of what types is this default typer valid for.
 
         protected final DefaultTyping _appliesFor;
 
         public DefaultTypeResolverBuilder(DefaultTyping t) {
              = t;
         }
 
         @Override
                 JavaType baseTypeCollection<NamedTypesubtypes)
         {
             return useForType(baseType) ? super.buildTypeDeserializer(configbaseTypesubtypes) : null;
         }
 
         @Override
         public TypeSerializer buildTypeSerializer(SerializationConfig config,
                 JavaType baseTypeCollection<NamedTypesubtypes)
         {
             return useForType(baseType) ? super.buildTypeSerializer(configbaseTypesubtypes) : null;            
         }

        
Method called to check if the default type handler should be used for given type. Note: "natural types" (String, Boolean, Integer, Double) will never use typing; that is both due to them being concrete and final, and since actual serializers and deserializers will also ignore any attempts to enforce typing.
 
         public boolean useForType(JavaType t)
         {
             switch () {
             case :
                 while (t.isArrayType()) {
                     t = t.getContentType();
                 }
                 // fall through
             case :
                 return (t.getRawClass() == Object.class) || !t.isConcrete();
             case :
                 while (t.isArrayType()) {
                     t = t.getContentType();
                 }
                 return !t.isFinal(); // includes Object.class
             default:
             //case JAVA_LANG_OBJECT:
                 return (t.getRawClass() == Object.class);
             }
         }
     }
 
     /*
     /**********************************************************
     /* Internal constants, singletons
     /**********************************************************
      */
     
     // Quick little shortcut, to avoid having to use global TypeFactory instance...
     private final static JavaType JSON_NODE_TYPE = SimpleType.constructUnsafe(JsonNode.class);
 
     /* !!! 03-Apr-2009, tatu: Should try to avoid direct reference... but not
      *   sure what'd be simple and elegant way. So until then:
      */
 
     // 16-May-2009, tatu: Ditto ^^^
 
     protected final static VisibilityChecker<?> STD_VISIBILITY_CHECKER = VisibilityChecker.Std.defaultInstance();
 
     protected final static PrettyPrinter _defaultPrettyPrinter = new DefaultPrettyPrinter();
    
    
Base settings contain defaults used for all ObjectMapper instances.
 
     protected final static BaseSettings DEFAULT_BASE = new BaseSettings(,
             null, TypeFactory.defaultInstance(),
             null.null,
             Locale.getDefault(),
 //            TimeZone.getDefault()
             TimeZone.getTimeZone("GMT"),
             Base64Variants.getDefaultVariant() // 2.1
     );
     
     /*
     /**********************************************************
     /* Configuration settings, shared
     /**********************************************************
      */

    
Factory used to create com.fasterxml.jackson.core.JsonParser and com.fasterxml.jackson.core.JsonGenerator instances as necessary.
 
     protected final JsonFactory _jsonFactory;

    
Specific factory used for creating JavaType instances; needed to allow modules to add more custom type handling (mostly to support types of non-Java JVM languages)
 
     protected TypeFactory _typeFactory;

    
Provider for values to inject in deserialized POJOs.
 
     protected InjectableValues _injectableValues;

    
Thing used for registering sub-types, resolving them to super/sub-types as needed.
 
     protected SubtypeResolver _subtypeResolver;

    
Cache for root names used when root-wrapping is enabled.
 
     protected final RootNameLookup _rootNames;
     
     /*
     /**********************************************************
     /* Configuration settings: mix-in annotations
     /**********************************************************
      */
    
    
Mapping that defines how to apply mix-in annotations: key is the type to received additional annotations, and value is the type that has annotations to "mix in".

Annotations associated with the value classes will be used to override annotations of the key class, associated with the same field or method. They can be further masked by sub-classes: you can think of it as injecting annotations between the target class and its sub-classes (or interfaces)

 
     protected final HashMap<ClassKey,Class<?>> _mixInAnnotations
         = new HashMap<ClassKey,Class<?>>();
     
     /*
     /**********************************************************
     /* Configuration settings, serialization
     /**********************************************************
      */

    
Configuration object that defines basic global settings for the serialization process
 
     protected SerializationConfig _serializationConfig;

    
Object that manages access to serializers used for serialization, including caching. It is configured with _serializerFactory to allow for constructing custom serializers.

Note: while serializers are only exposed SerializerProvider, mappers and readers need to access additional API defined by com.fasterxml.jackson.databind.ser.DefaultSerializerProvider

 
     protected DefaultSerializerProvider _serializerProvider;

    
Serializer factory used for constructing serializers.
 
 
     /*
     /**********************************************************
     /* Configuration settings, deserialization
     /**********************************************************
      */

    
Configuration object that defines basic global settings for the serialization process
 
     protected DeserializationConfig _deserializationConfig;

    
Blueprint context object; stored here to allow custom sub-classes. Contains references to objects needed for deserialization construction (cache, factory).
 
 
     /*
     /**********************************************************
     /* Caching
     /**********************************************************
      */
 
     /* Note: handling of serializers and deserializers is not symmetric;
      * and as a result, only root-level deserializers can be cached here.
      * This is mostly because typing and resolution for deserializers is
      * fully static; whereas it is quite dynamic for serialization.
      */

    
We will use a separate main-level Map for keeping track of root-level deserializers. This is where most succesful cache lookups get resolved. Map will contain resolvers for all kinds of types, including container types: this is different from the component cache which will only cache bean deserializers.

Given that we don't expect much concurrency for additions (should very quickly converge to zero after startup), let's explicitly define a low concurrency setting.

Since version 1.5, these may are either "raw" deserializers (when no type information is needed for base type), or type-wrapped deserializers (if it is needed)

 
         = new ConcurrentHashMap<JavaTypeJsonDeserializer<Object>>(64, 0.6f, 2);
 
     /*
     /**********************************************************
     /* Life-cycle: constructing instance
     /**********************************************************
      */

    
Default constructor, which will construct the default com.fasterxml.jackson.core.JsonFactory as necessary, use SerializerProvider as its SerializerProvider, and com.fasterxml.jackson.databind.ser.BeanSerializerFactory as its com.fasterxml.jackson.databind.ser.SerializerFactory. This means that it can serialize all standard JDK types, as well as regular Java Beans (based on method names and Jackson-specific annotations), but does not support JAXB annotations.
 
     public ObjectMapper()
     {
         this(nullnullnull);
     }

    
Constructs instance that uses specified com.fasterxml.jackson.core.JsonFactory for constructing necessary com.fasterxml.jackson.core.JsonParsers and/or com.fasterxml.jackson.core.JsonGenerators.
 
     public ObjectMapper(JsonFactory jf)
     {
         this(jfnullnull);
     }

    
Copy-constructor, mostly used to support copy().

Since:
2.1
 
     protected ObjectMapper(ObjectMapper src)
     {
          = src._jsonFactory.copy();
         .setCodec(this);
          = src._subtypeResolver;
          = new RootNameLookup();
          = src._typeFactory;
          = src._serializationConfig;
          = new SerializationConfig(src._serializationConfig);
          = new DeserializationConfig(src._deserializationConfig);
          = src._serializerProvider;
          = src._deserializationContext;
 
         // Default serializer factory is stateless, can just assign
          = src._serializerFactory;
     }
    
    
Constructs instance that uses specified com.fasterxml.jackson.core.JsonFactory for constructing necessary com.fasterxml.jackson.core.JsonParsers and/or com.fasterxml.jackson.core.JsonGenerators, and uses given providers for accessing serializers and deserializers.

Parameters:
jf JsonFactory to use: if null, a new MappingJsonFactory will be constructed
sp SerializerProvider to use: if null, a SerializerProvider will be constructed
dc Blueprint deserialization context instance to use for creating actual context objects; if null, will construct standard DeserializationContext
 
     public ObjectMapper(JsonFactory jf,
             DefaultSerializerProvider spDefaultDeserializationContext dc)
     {
         /* 02-Mar-2009, tatu: Important: we MUST default to using
          *   the mapping factory, otherwise tree serialization will
          *   have problems with POJONodes.
          * 03-Jan-2010, tatu: and obviously we also must pass 'this',
          *    to create actual linking.
          */
         if (jf == null) {
              = new MappingJsonFactory(this);
         } else {
              = jf;
             if (jf.getCodec() == null) { // as per [JACKSON-741]
                 .setCodec(this);
             }
         }
          = new StdSubtypeResolver();
          = new RootNameLookup();
         // and default type factory is shared one
          = TypeFactory.defaultInstance();
                     );
                     );
          = (sp == null) ? new DefaultSerializerProvider.Impl() : sp;
          = (dc == null) ?
                 new DefaultDeserializationContext.Impl(.) : dc;
 
         // Default serializer factory is stateless, can just assign
     }

    
Method for creating a new ObjectMapper instance that has same initial configuration as this instance. Note that this also requires making a copy of the underlying com.fasterxml.jackson.core.JsonFactory instance.

Method is typically used when multiple, differently configured mappers are needed. Although configuration is shared, cached serializers and deserializers are NOT shared, which means that the new instance may be re-configured before use; meaning that it behaves the same way as if an instance was constructed from scratch.

Since:
2.1
 
     public ObjectMapper copy()
     {
         _checkInvalidCopy(ObjectMapper.class);
         return new ObjectMapper(this);
     }

    

Parameters:
exp
Since:
2.1
 
     protected void _checkInvalidCopy(Class<?> exp)
     {
         if (getClass() != exp) {
             throw new IllegalStateException("Failed copy(): "+getClass().getName()
                     +" (version: "+version()+") does not override copy(); it has to");
         }
     }
     
     /*
     /**********************************************************
     /* Versioned impl
     /**********************************************************
      */
    
    
Method that will return version information stored in and read from jar that contains this class.
 
 //  @Override
     public Version version() {
         return ..version();
     }
     
     /*
     /**********************************************************
     /* Module registration
     /**********************************************************
      */

    
Method for registering a module that can extend functionality provided by this mapper; for example, by adding providers for custom serializers and deserializers.

Parameters:
module Module to register
 
     public ObjectMapper registerModule(Module module)
     {
         /* Let's ensure we have access to name and version information, 
          * even if we do not have immediate use for either. This way we know
          * that they will be available from beginning
          */
         String name = module.getModuleName();
         if (name == null) {
             throw new IllegalArgumentException("Module without defined name");
         }
         Version version = module.version();
         if (version == null) {
             throw new IllegalArgumentException("Module without defined version");
         }
 
         final ObjectMapper mapper = this;
         
         // And then call registration
         module.setupModule(new Module.SetupContext()
         {
             // // // Accessors
 
 //          @Override
             public Version getMapperVersion() {
                 return version();
             }
 
             @SuppressWarnings("unchecked")
 //          @Override
             public <C extends ObjectCodec> C getOwner() {
                 // why do we need the cast here?!?
                 return (C) mapper;
             }
 
 //          @Override
             public TypeFactory getTypeFactory() {
                 return ;
             }
             
 //          @Override
             public boolean isEnabled(MapperFeature f) {
                 return mapper.isEnabled(f);
             }
 
 //          @Override
             public boolean isEnabled(DeserializationFeature f) {
                 return mapper.isEnabled(f);
             }
             
 //          @Override
             public boolean isEnabled(SerializationFeature f) {
                 return mapper.isEnabled(f);
             }
 
 //          @Override
             public boolean isEnabled(JsonFactory.Feature f) {
                 return mapper.isEnabled(f);
             }
 
 //          @Override
             public boolean isEnabled(JsonParser.Feature f) {
                 return mapper.isEnabled(f);
             }
             
 //          @Override
             public boolean isEnabled(JsonGenerator.Feature f) {
                 return mapper.isEnabled(f);
             }
             
             // // // Methods for registering handlers: deserializers
             
 //          @Override
             public void addDeserializers(Deserializers d) {
                 DeserializerFactory df = mapper._deserializationContext._factory.withAdditionalDeserializers(d);
                 mapper._deserializationContext = mapper._deserializationContext.with(df);
             }
 
 //          @Override
             public void addKeyDeserializers(KeyDeserializers d) {
                 DeserializerFactory df = mapper._deserializationContext._factory.withAdditionalKeyDeserializers(d);
                 mapper._deserializationContext = mapper._deserializationContext.with(df);
             }
 
 //          @Override
             public void addBeanDeserializerModifier(BeanDeserializerModifier modifier) {
                 DeserializerFactory df = mapper._deserializationContext._factory.withDeserializerModifier(modifier);
                 mapper._deserializationContext = mapper._deserializationContext.with(df);
             }
             
             // // // Methods for registering handlers: serializers
             
 //          @Override
             public void addSerializers(Serializers s) {
                 mapper._serializerFactory = mapper._serializerFactory.withAdditionalSerializers(s);
             }
 
 //          @Override
             public void addKeySerializers(Serializers s) {
                 mapper._serializerFactory = mapper._serializerFactory.withAdditionalKeySerializers(s);
             }
             
 //          @Override
             public void addBeanSerializerModifier(BeanSerializerModifier modifier) {
                 mapper._serializerFactory = mapper._serializerFactory.withSerializerModifier(modifier);
             }
 
             // // // Methods for registering handlers: other
             
 //          @Override
             public void addAbstractTypeResolver(AbstractTypeResolver resolver) {
                 DeserializerFactory df = mapper._deserializationContext._factory.withAbstractTypeResolver(resolver);
                 mapper._deserializationContext = mapper._deserializationContext.with(df);
             }
 
 //          @Override
             public void addTypeModifier(TypeModifier modifier) {
                 TypeFactory f = mapper._typeFactory;
                 f = f.withModifier(modifier);
                 mapper.setTypeFactory(f);
             }
 
 //          @Override
             public void addValueInstantiators(ValueInstantiators instantiators) {
                 DeserializerFactory df = mapper._deserializationContext._factory.withValueInstantiators(instantiators);
                 mapper._deserializationContext = mapper._deserializationContext.with(df);
             }
             
 //          @Override
             public void insertAnnotationIntrospector(AnnotationIntrospector ai) {
                 mapper._deserializationConfig = mapper._deserializationConfig.withInsertedAnnotationIntrospector(ai);
                 mapper._serializationConfig = mapper._serializationConfig.withInsertedAnnotationIntrospector(ai);
             }
             
 //          @Override
             public void appendAnnotationIntrospector(AnnotationIntrospector ai) {
                 mapper._deserializationConfig = mapper._deserializationConfig.withAppendedAnnotationIntrospector(ai);
                 mapper._serializationConfig = mapper._serializationConfig.withAppendedAnnotationIntrospector(ai);
             }
 
 //          @Override
             public void registerSubtypes(Class<?>... subtypes) {
                 mapper.registerSubtypes(subtypes);
             }
 
 //          @Override
             public void registerSubtypes(NamedType... subtypes) {
                 mapper.registerSubtypes(subtypes);
             }
             
 //          @Override
             public void setMixInAnnotations(Class<?> targetClass<?> mixinSource) {
                 mapper.addMixInAnnotations(targetmixinSource);
             }
             
 //          @Override
             public void addDeserializationProblemHandler(DeserializationProblemHandler handler) {
                 mapper.addHandler(handler);
             }
         });
         return this;
     }
 
     /*
     /**********************************************************
     /* Configuration: main config object access
     /**********************************************************
      */

    
Method that returns the shared default SerializationConfig object that defines configuration settings for serialization.

Note that since instances are immutable, you can NOT change settings by accessing an instance and calling methods: this will simply create new instance of config object.

 
         return ;
     }

    
Method that returns the shared default DeserializationConfig object that defines configuration settings for deserialization.

Note that since instances are immutable, you can NOT change settings by accessing an instance and calling methods: this will simply create new instance of config object.

 
         return ;
     }
    
    
Method for getting current DeserializationContext.

Note that since instances are immutable, you can NOT change settings by accessing an instance and calling methods: this will simply create new instance of context object.

 
         return ;
     }
 
     /*
     /**********************************************************
     /* Configuration: ser/deser factory, provider access
     /**********************************************************
      */
    
    
Method for setting specific com.fasterxml.jackson.databind.ser.SerializerFactory to use for constructing (bean) serializers.
 
          = f;
         return this;
     }

    
Method for getting current com.fasterxml.jackson.databind.ser.SerializerFactory.

Note that since instances are immutable, you can NOT change settings by accessing an instance and calling methods: this will simply create new instance of factory object.

 
         return ;
     }

    
Method for setting specific SerializerProvider to use for handling caching of JsonSerializer instances.
 
          = p;
         return this;
     }
 
         return ;
     }
     
     /*
     /**********************************************************
     /* Configuration: mix-in annotations
     /**********************************************************
      */
    
    
Method to use for defining mix-in annotations to use for augmenting annotations that processable (serializable / deserializable) classes have. Mixing in is done when introspecting class annotations and properties. Map passed contains keys that are target classes (ones to augment with new annotation overrides), and values that are source classes (have annotations to use for augmentation). Annotations from source classes (and their supertypes) will override annotations that target classes (and their super-types) have.
 
     public final void setMixInAnnotations(Map<Class<?>, Class<?>> sourceMixins)
     {
         .clear();
         if (sourceMixins != null && sourceMixins.size() > 0) {
             for (Map.Entry<Class<?>,Class<?>> en : sourceMixins.entrySet()) {
                 .put(new ClassKey(en.getKey()), en.getValue());
             }
         }
     }

    
Method to use for adding mix-in annotations to use for augmenting specified class or interface. All annotations from mixinSource are taken to override annotations that target (or its supertypes) has.

Parameters:
target Class (or interface) whose annotations to effectively override
mixinSource Class (or interface) whose annotations are to be "added" to target's annotations, overriding as necessary
 
     public final void addMixInAnnotations(Class<?> targetClass<?> mixinSource)
     {
         .put(new ClassKey(target), mixinSource);
     }
 
     public final Class<?> findMixInClassFor(Class<?> cls) {
         return ( == null) ? null : .get(new ClassKey(cls));
     }
 
     public final int mixInCount() {
         return ( == null) ? 0 : .size();
     }
     
     /*
     /**********************************************************
     /* Configuration, introspection
     /**********************************************************
      */

    
Method for accessing currently configured visibility checker; object used for determining whether given property element (method, field, constructor) can be auto-detected or not.
 
     public VisibilityChecker<?> getVisibilityChecker() {
     }

    
Method for setting currently configured visibility checker; object used for determining whether given property element (method, field, constructor) can be auto-detected or not. This default checker is used if no per-class overrides are defined.
     
     public void setVisibilityChecker(VisibilityChecker<?> vc) {
     }

    
Convenience method that allows changing configuration for underlying com.fasterxml.jackson.databind.introspect.VisibilityCheckers, to change details of what kinds of properties are auto-detected. Basically short cut for doing:
  mapper.setVisibilityChecker(
     mapper.getVisibilityChecker().withVisibility(forMethod, visibility)
  );
one common use case would be to do:
  mapper.setVisibility(JsonMethod.FIELD, Visibility.ANY);
which would make all member fields serializable without further annotations, instead of just public fields (default setting).

Parameters:
forMethod Type of property descriptor affected (field, getter/isGetter, setter, creator)
visibility Minimum visibility to require for the property descriptors of type
Returns:
Modified mapper instance (that is, "this"), to allow chaining of configuration calls
 
     public ObjectMapper setVisibility(PropertyAccessor forMethodJsonAutoDetect.Visibility visibility)
     {
          = .withVisibility(forMethodvisibility);
          = .withVisibility(forMethodvisibility);
         return this;
     }
    
    
Method for accessing subtype resolver in use.
 
     public SubtypeResolver getSubtypeResolver() {
         return ;
     }

    
Method for setting custom subtype resolver to use.
 
          = str;
         return this;
     }

    
Method for changing AnnotationIntrospector used by this mapper instance for both serialization and deserialization
 
         return this;
     }

    
Method for changing AnnotationIntrospector instances used by this mapper instance for serialization and deserialization, specifying them separately so that different introspection can be used for different aspects

Parameters:
serializerAI AnnotationIntrospector to use for configuring serialization
deserializerAI AnnotationIntrospector to use for configuring deserialization
Since:
2.1
 
             AnnotationIntrospector deserializerAI) {
          = .with(serializerAI);
          = .with(deserializerAI);
         return this;
     }
    
    
Method for setting custom property naming strategy to use.
 
         return this;
     }

    
Method for setting defalt POJO property inclusion strategy for serialization.
 
         return this;
     }
     
     /*
     /**********************************************************
     /* Type information configuration (1.5+)
     /**********************************************************
      */

    
Convenience method that is equivalent to calling
  enableObjectTyping(DefaultTyping.OBJECT_AND_NON_CONCRETE);
 
     public ObjectMapper enableDefaultTyping() {
     }

    
Convenience method that is equivalent to calling
  enableObjectTyping(dti, JsonTypeInfo.As.WRAPPER_ARRAY);
 
         return enableDefaultTyping(dti..);
     }

    
Method for enabling automatic inclusion of type information, needed for proper deserialization of polymorphic types (unless types have been annotated with com.fasterxml.jackson.annotation.JsonTypeInfo).

Parameters:
applicability Defines kinds of types for which additional type information is added; see ObjectMapper.DefaultTyping for more information.
 
     public ObjectMapper enableDefaultTyping(DefaultTyping applicabilityJsonTypeInfo.As includeAs)
     {
         TypeResolverBuilder<?> typer = new DefaultTypeResolverBuilder(applicability);
         // we'll always use full class name, when using defaulting
         typer = typer.init(..null);
         typer = typer.inclusion(includeAs);
         return setDefaultTyping(typer);
     }

    
Method for enabling automatic inclusion of type information -- needed for proper deserialization of polymorphic types (unless types have been annotated with com.fasterxml.jackson.annotation.JsonTypeInfo) -- using "As.PROPERTY" inclusion mechanism and specified property name to use for inclusion (default being "@class" since default type information always uses class name as type identifier)
 
     public ObjectMapper enableDefaultTypingAsProperty(DefaultTyping applicabilityString propertyName)
     {
         TypeResolverBuilder<?> typer = new DefaultTypeResolverBuilder(applicability);
         // we'll always use full class name, when using defaulting
         typer = typer.init(..null);
         typer = typer.inclusion(..);
         typer = typer.typeProperty(propertyName);
         return setDefaultTyping(typer);
     }
    
    
Method for disabling automatic inclusion of type information; if so, only explicitly annotated types (ones with com.fasterxml.jackson.annotation.JsonTypeInfo) will have additional embedded type information.
 
     public ObjectMapper disableDefaultTyping() {
         return setDefaultTyping(null);
     }

    
Method for enabling automatic inclusion of type information, using specified handler object for determining which types this affects, as well as details of how information is embedded.

Parameters:
typer Type information inclusion handler
        return this;
    }

    
Method for registering specified class as a subtype, so that typename-based resolution can link supertypes to subtypes (as an alternative to using annotations). Type for given class is determined from appropriate annotation; or if missing, default name (unqualified class name)
    public void registerSubtypes(Class<?>... classes) {
        getSubtypeResolver().registerSubtypes(classes);
    }

    
Method for registering specified class as a subtype, so that typename-based resolution can link supertypes to subtypes (as an alternative to using annotations). Name may be provided as part of argument, but if not will be based on annotations or use default name (unqualified class name).
    public void registerSubtypes(NamedType... types) {
        getSubtypeResolver().registerSubtypes(types);
    }
    /*
    /**********************************************************
    /* Configuration, basic type handling
    /**********************************************************
     */

    
Accessor for getting currently configured com.fasterxml.jackson.databind.type.TypeFactory instance.
    public TypeFactory getTypeFactory() {
        return ;
    }

    
Method that can be used to override com.fasterxml.jackson.databind.type.TypeFactory instance used by this mapper.

Note: will also set com.fasterxml.jackson.databind.type.TypeFactory that deserialization and serialization config objects use.

    {
         = f;
        return this;
    }
    
    
Convenience method for constructing JavaType out of given type (typically java.lang.Class), but without explicit context.
    public JavaType constructType(Type t) {
        return .constructType(t);
    }
    
    /*
    /**********************************************************
    /* Configuration, deserialization
    /**********************************************************
     */
    
    
Method for specifying com.fasterxml.jackson.databind.node.JsonNodeFactory to use for constructing root level tree nodes (via method createObjectNode()
        return this;
    }

    
Method for adding specified com.fasterxml.jackson.databind.deser.DeserializationProblemHandler to be used for handling specific problems during deserialization.
        return this;
    }

    
Method for removing all registered com.fasterxml.jackson.databind.deser.DeserializationProblemHandlers instances from this mapper.
        return this;
    }
    
    
    /*
    /**********************************************************
    /* Configuration, serialization
    /**********************************************************
     */

    
Convenience method that is equivalent to:
  mapper.setFilters(mapper.getSerializationConfig().withFilters(filterProvider));

Note that usually it is better to use method writer(com.fasterxml.jackson.databind.ser.FilterProvider); however, sometimes this method is more convenient. For example, some frameworks only allow configuring of ObjectMapper instances and not ObjectWriters.

    public void setFilters(FilterProvider filterProvider) {
         = .withFilters(filterProvider);
    }

    
Method that will configure default com.fasterxml.jackson.core.Base64Variant that byte[] serializers and deserializers will use.

Parameters:
v Base64 variant to use
Since:
2.1
Returns:
This mapper, for convenience to allow chaining
        return this;
    }
    
    /*
    /**********************************************************
    /* Configuration, other
    /**********************************************************
     */

    
Method that can be used to get hold of com.fasterxml.jackson.core.JsonFactory that this mapper uses if it needs to construct com.fasterxml.jackson.core.JsonParsers and/or com.fasterxml.jackson.core.JsonGenerators.

Returns:
com.fasterxml.jackson.core.JsonFactory that this mapper uses when it needs to construct Json parser and generators
    @Override
    public JsonFactory getFactory() { return ; }
    
    

Deprecated:
Since 2.1: Use getFactory() instead
    @Override
    public JsonFactory getJsonFactory() { return ; }

    
Method for configuring the default java.text.DateFormat to use when serializing time values as Strings, and deserializing from JSON Strings. This is preferably to directly modifying SerializationConfig and DeserializationConfig instances. If you need per-request configuration, use writer(java.text.DateFormat) to create properly configured ObjectWriter and use that; this because ObjectWriters are thread-safe whereas ObjectMapper itself is only thread-safe when configuring methods (such as this one) are NOT called.
    public ObjectMapper setDateFormat(DateFormat dateFormat)
    {
         = .with(dateFormat);
         = .with(dateFormat);
        return this;
    }

    
Method for configuring com.fasterxml.jackson.databind.cfg.HandlerInstantiator to use for creating instances of handlers (such as serializers, deserializers, type and type id resolvers), given a class.

Parameters:
hi Instantiator to use; if null, use the default implementation
    {
        return this;
    }
    
    
Method for configuring InjectableValues which used to find values to inject.
    public ObjectMapper setInjectableValues(InjectableValues injectableValues) {
         = injectableValues;
        return this;
    }
    
    
Method for overriding default locale to use for formatting. Default value used is java.util.Locale.getDefault().
    public ObjectMapper setLocale(Locale l) {
        return this;
    }

    
Method for overriding default TimeZone to use for formatting. Default value used is java.util.TimeZone.getDefault().
    public ObjectMapper setTimeZone(TimeZone tz) {
        return this;
    }
    
    /*
    /**********************************************************
    /* Configuration, simple features
    /**********************************************************
     */

    
Method for changing state of an on/off mapper feature for this mapper instance.
    public ObjectMapper configure(MapperFeature fboolean state) {
         = state ?
                .with(f) : .without(f);
         = state ?
                .with(f) : .without(f);
        return this;
    }
    
    
Method for changing state of an on/off serialization feature for this object mapper.
    public ObjectMapper configure(SerializationFeature fboolean state) {
         = state ?
                .with(f) : .without(f);
        return this;
    }

    
Method for changing state of an on/off deserialization feature for this object mapper.
    public ObjectMapper configure(DeserializationFeature fboolean state) {
         = state ?
                .with(f) : .without(f);
        return this;
    }

    
Method for changing state of an on/off com.fasterxml.jackson.core.JsonParser feature for com.fasterxml.jackson.core.JsonFactory instance this object mapper uses.

This is method is basically a shortcut method for calling com.fasterxml.jackson.core.JsonFactory.enable(com.fasterxml.jackson.core.JsonFactory.Feature) on the shared com.fasterxml.jackson.core.JsonFactory this mapper uses (which is accessible using getJsonFactory()).

    public ObjectMapper configure(JsonParser.Feature fboolean state) {
        .configure(fstate);
        return this;
    }

    
Method for changing state of an on/off com.fasterxml.jackson.core.JsonGenerator feature for com.fasterxml.jackson.core.JsonFactory instance this object mapper uses.

This is method is basically a shortcut method for calling com.fasterxml.jackson.core.JsonFactory.enable(com.fasterxml.jackson.core.JsonFactory.Feature) on the shared com.fasterxml.jackson.core.JsonFactory this mapper uses (which is accessible using getJsonFactory()).

    public ObjectMapper configure(JsonGenerator.Feature fboolean state) {
        .configure(fstate);
        return this;
    }

    
Method for enabling specified com.fasterxml.jackson.databind.cfg.MapperConfig features. Modifies and returns this instance; no new object is created.
    public ObjectMapper enable(MapperFeature... f) {
        return this;
    }

    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
    public ObjectMapper disable(MapperFeature... f) {
        return this;
    }
    
    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
    public ObjectMapper enable(DeserializationFeature feature) {
        return this;
    }

    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
            DeserializationFeature... f) {
        return this;
    }
    
    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
    public ObjectMapper disable(DeserializationFeature feature) {
        return this;
    }

    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
            DeserializationFeature... f) {
        return this;
    }
    
    
Method for enabling specified DeserializationConfig feature. Modifies and returns this instance; no new object is created.
        return this;
    }

    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
            SerializationFeature... f) {
         = .with(firstf);
        return this;
    }
    
    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
        return this;
    }

    
Method for enabling specified DeserializationConfig features. Modifies and returns this instance; no new object is created.
            SerializationFeature... f) {
         = .without(firstf);
        return this;
    }

    
Method for checking whether given Mapper feature is enabled.
    public boolean isEnabled(MapperFeature f) {
        // ok to use either one, should be kept in sync
        return .isEnabled(f);
    }

    
Method for checking whether given serialization-specific feature is enabled.
    public boolean isEnabled(SerializationFeature f) {
        return .isEnabled(f);
    }
    
    
Method for checking whether given deserialization-specific feature is enabled.
    public boolean isEnabled(DeserializationFeature f) {
        return .isEnabled(f);
    }

    
Convenience method, equivalent to:
  getJsonFactory().isEnabled(f);
    public boolean isEnabled(JsonFactory.Feature f) {
        return .isEnabled(f);
    }

    
Convenience method, equivalent to:
  getJsonFactory().isEnabled(f);
    public boolean isEnabled(JsonParser.Feature f) {
        return .isEnabled(f);
    }
    
    
Convenience method, equivalent to:
  getJsonFactory().isEnabled(f);
    public boolean isEnabled(JsonGenerator.Feature f) {
        return .isEnabled(f);
    }
    
    
Method that can be used to get hold of com.fasterxml.jackson.databind.node.JsonNodeFactory that this mapper will use when directly constructing root JsonNode instances for Trees.

Note: this is just a shortcut for calling

   getDeserializationConfig().getNodeFactory()
    public JsonNodeFactory getNodeFactory() {
        return .getNodeFactory();
    }
    /*
    /**********************************************************
    /* Public API (from ObjectCodec): deserialization
    /* (mapping from JSON to Java types);
    /* main methods
    /**********************************************************
     */

    
Method to deserialize JSON content into a non-container type (it can be an array type, however): typically a bean, array or a wrapper type (like java.lang.Boolean).

Note: this method should NOT be used if the result type is a container (java.util.Collection or java.util.Map. The reason is that due to type erasure, key and value types can not be introspected when using this method.

    @Override
    @SuppressWarnings("unchecked")
    public <T> T readValue(JsonParser jpClass<T> valueType)
    {
        return (T) _readValue(getDeserializationConfig(), jp.constructType(valueType));
    } 

    
Method to deserialize JSON content into a Java type, reference to which is passed as argument. Type is passed using so-called "super type token" (see ) and specifically needs to be used if the root type is a parameterized (generic) container type.
    @Override
    @SuppressWarnings("unchecked")
    public <T> T readValue(JsonParser jpTypeReference<?> valueTypeRef)
    {
        return (T) _readValue(getDeserializationConfig(), jp.constructType(valueTypeRef));
    }

    
Method to deserialize JSON content into a Java type, reference to which is passed as argument. Type is passed using Jackson specific type; instance of which can be constructed using com.fasterxml.jackson.databind.type.TypeFactory.
    @Override
    @SuppressWarnings("unchecked")
    public final <T> T readValue(JsonParser jpResolvedType valueType)
    {
        return (T) _readValue(getDeserializationConfig(), jp, (JavaTypevalueType);
    }

    
    @SuppressWarnings("unchecked")
    public <T> T readValue(JsonParser jpJavaType valueType)
    {
        return (T) _readValue(getDeserializationConfig(), jpvalueType);
    }
    
    
Method to deserialize JSON content as tree expressed using set of JsonNode instances. Returns root of the resulting tree (where root can consist of just a single node if the current event is a value event, not container).
    @Override
    public <T extends TreeNode> T readTree(JsonParser jp)
        throws IOExceptionJsonProcessingException
    {
        /* 02-Mar-2009, tatu: One twist; deserialization provider
         *   will map JSON null straight into Java null. But what
         *   we want to return is the "null node" instead.
         */
        /* 05-Aug-2011, tatu: Also, must check for EOF here before
         *   calling readValue(), since that'll choke on it otherwise
         */
        JsonToken t = jp.getCurrentToken();
        if (t == null) {
            t = jp.nextToken();
            if (t == null) {
                return null;
            }
        }
        JsonNode n = (JsonNode_readValue(cfgjp);
        if (n == null) {
            n = getNodeFactory().nullNode();
        }
        @SuppressWarnings("unchecked")
        T result = (T) n;
        return result;