Class StdValueInstantiator
- java.lang.Object
 - 
- com.fasterxml.jackson.databind.deser.ValueInstantiator
 - 
- com.fasterxml.jackson.databind.deser.std.StdValueInstantiator
 
 
 
- 
- All Implemented Interfaces:
 java.io.Serializable
public class StdValueInstantiator extends ValueInstantiator implements java.io.Serializable
DefaultValueInstantiatorimplementation, which supports Creator methods that can be indicated by standard Jackson annotations.- See Also:
 - Serialized Form
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.deser.ValueInstantiator
ValueInstantiator.Base, ValueInstantiator.Delegating, ValueInstantiator.Gettable 
 - 
 
- 
Constructor Summary
Constructors Constructor Description StdValueInstantiator(DeserializationConfig config, JavaType valueType)StdValueInstantiator(DeserializationConfig config, java.lang.Class<?> valueType)Deprecated.Since 2.7 use constructor that takesJavaTypeinstead 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanCreateFromBigDecimal()Method that can be called to check whether a BigDecimal based creator is available to use (to callValueInstantiator.createFromBigDecimal(com.fasterxml.jackson.databind.DeserializationContext, java.math.BigDecimal)).booleancanCreateFromBigInteger()Method that can be called to check whether a BigInteger based creator is available to use (to callValueInstantiator.createFromBigInteger(com.fasterxml.jackson.databind.DeserializationContext, java.math.BigInteger)).booleancanCreateFromBoolean()Method that can be called to check whether a double (boolean / Boolean) based creator is available to use (to callValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)).booleancanCreateFromDouble()Method that can be called to check whether a double (double / Double) based creator is available to use (to callValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)).booleancanCreateFromInt()Method that can be called to check whether an integer (int, Integer) based creator is available to use (to callValueInstantiator.createFromInt(com.fasterxml.jackson.databind.DeserializationContext, int)).booleancanCreateFromLong()Method that can be called to check whether a long (long, Long) based creator is available to use (to callValueInstantiator.createFromLong(com.fasterxml.jackson.databind.DeserializationContext, long)).booleancanCreateFromObjectWith()Method that can be called to check whether a property-based creator (argument-taking constructor or factory method) is available to instantiate values from JSON ObjectbooleancanCreateFromString()Method that can be called to check whether a String-based creator is available for this instantiator.booleancanCreateUsingArrayDelegate()Method that can be called to check whether a array-delegate-based creator (single-arg constructor or factory method) is available for this instantiatorbooleancanCreateUsingDefault()Method that can be called to check whether a default creator (constructor, or no-arg static factory method) is available for this instantiatorbooleancanCreateUsingDelegate()Method that can be called to check whether a delegate-based creator (single-arg constructor or factory method) is available for this instantiatorbooleancanInstantiate()Method that will return true if any ofcanCreateXxxmethod returns true: that is, if there is any way that an instance could be created.voidconfigureFromArraySettings(AnnotatedWithParams arrayDelegateCreator, JavaType arrayDelegateType, SettableBeanProperty[] arrayDelegateArgs)voidconfigureFromBigDecimalCreator(AnnotatedWithParams creator)voidconfigureFromBigIntegerCreator(AnnotatedWithParams creator)voidconfigureFromBooleanCreator(AnnotatedWithParams creator)voidconfigureFromDoubleCreator(AnnotatedWithParams creator)voidconfigureFromIntCreator(AnnotatedWithParams creator)voidconfigureFromLongCreator(AnnotatedWithParams creator)voidconfigureFromObjectSettings(AnnotatedWithParams defaultCreator, AnnotatedWithParams delegateCreator, JavaType delegateType, SettableBeanProperty[] delegateArgs, AnnotatedWithParams withArgsCreator, SettableBeanProperty[] constructorArgs)Method for setting properties related to instantiating values from JSON Object.voidconfigureFromStringCreator(AnnotatedWithParams creator)java.lang.ObjectcreateFromBigDecimal(DeserializationContext ctxt, java.math.BigDecimal value)java.lang.ObjectcreateFromBigInteger(DeserializationContext ctxt, java.math.BigInteger value)java.lang.ObjectcreateFromBoolean(DeserializationContext ctxt, boolean value)java.lang.ObjectcreateFromDouble(DeserializationContext ctxt, double value)java.lang.ObjectcreateFromInt(DeserializationContext ctxt, int value)java.lang.ObjectcreateFromLong(DeserializationContext ctxt, long value)java.lang.ObjectcreateFromObjectWith(DeserializationContext ctxt, java.lang.Object[] args)Method called to create value instance from JSON Object when instantiation arguments are passed; this is done, for example when passing information specified with "Creator" annotations.java.lang.ObjectcreateFromString(DeserializationContext ctxt, java.lang.String value)java.lang.ObjectcreateUsingArrayDelegate(DeserializationContext ctxt, java.lang.Object delegate)Method to called to create value instance from JSON Array using an intermediate "delegate" value to pass to createor methodjava.lang.ObjectcreateUsingDefault(DeserializationContext ctxt)Method called to create value instance from a JSON value when no data needs to passed to creator (constructor, factory method); typically this will call the default constructor of the value object.java.lang.ObjectcreateUsingDelegate(DeserializationContext ctxt, java.lang.Object delegate)Method to called to create value instance from JSON Object using an intermediate "delegate" value to pass to createor methodAnnotatedWithParamsgetArrayDelegateCreator()Method that can be called to try to access member (constructor, static factory method) that is used as the "array delegate creator".JavaTypegetArrayDelegateType(DeserializationConfig config)Method that can be used to determine what is the type of array delegate type to use, if any; if no delegates are used, will return null.AnnotatedWithParamsgetDefaultCreator()Method that can be called to try to access member (constructor, static factory method) that is used as the "default creator" (creator that is called without arguments; typically default [zero-argument] constructor of the type).AnnotatedWithParamsgetDelegateCreator()Method that can be called to try to access member (constructor, static factory method) that is used as the "delegate creator".JavaTypegetDelegateType(DeserializationConfig config)Method that can be used to determine what is the type of delegate type to use, if any; if no delegates are used, will return null.SettableBeanProperty[]getFromObjectArguments(DeserializationConfig config)Method called to determine types of instantiation arguments to use when creating instances with creator arguments (whenValueInstantiator.canCreateFromObjectWith()returns true).java.lang.Class<?>getValueClass()Accessor for raw (type-erased) type of instances to create.java.lang.StringgetValueTypeDesc()Method that returns description of the value type this instantiator handles.AnnotatedWithParamsgetWithArgsCreator()Method that can be called to try to access member (constructor, static factory method) that is used as the "non-default creator" (constructor or factory method that takes one or more arguments).- 
Methods inherited from class com.fasterxml.jackson.databind.deser.ValueInstantiator
createContextual, createFromObjectWith 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
StdValueInstantiator
@Deprecated public StdValueInstantiator(DeserializationConfig config, java.lang.Class<?> valueType)
Deprecated.Since 2.7 use constructor that takesJavaTypeinstead 
- 
StdValueInstantiator
public StdValueInstantiator(DeserializationConfig config, JavaType valueType)
 
 - 
 
- 
Method Detail
- 
configureFromObjectSettings
public void configureFromObjectSettings(AnnotatedWithParams defaultCreator, AnnotatedWithParams delegateCreator, JavaType delegateType, SettableBeanProperty[] delegateArgs, AnnotatedWithParams withArgsCreator, SettableBeanProperty[] constructorArgs)
Method for setting properties related to instantiating values from JSON Object. We will choose basically only one approach (out of possible three), and clear other properties 
- 
configureFromArraySettings
public void configureFromArraySettings(AnnotatedWithParams arrayDelegateCreator, JavaType arrayDelegateType, SettableBeanProperty[] arrayDelegateArgs)
 
- 
configureFromStringCreator
public void configureFromStringCreator(AnnotatedWithParams creator)
 
- 
configureFromIntCreator
public void configureFromIntCreator(AnnotatedWithParams creator)
 
- 
configureFromLongCreator
public void configureFromLongCreator(AnnotatedWithParams creator)
 
- 
configureFromBigIntegerCreator
public void configureFromBigIntegerCreator(AnnotatedWithParams creator)
 
- 
configureFromDoubleCreator
public void configureFromDoubleCreator(AnnotatedWithParams creator)
 
- 
configureFromBigDecimalCreator
public void configureFromBigDecimalCreator(AnnotatedWithParams creator)
 
- 
configureFromBooleanCreator
public void configureFromBooleanCreator(AnnotatedWithParams creator)
 
- 
getValueTypeDesc
public java.lang.String getValueTypeDesc()
Description copied from class:ValueInstantiatorMethod that returns description of the value type this instantiator handles. Used for error messages, diagnostics.- Overrides:
 getValueTypeDescin classValueInstantiator
 
- 
getValueClass
public java.lang.Class<?> getValueClass()
Description copied from class:ValueInstantiatorAccessor for raw (type-erased) type of instances to create.NOTE: since this method has not existed since beginning of Jackson 2.0 series, default implementation will just return
Object.class; implementations are expected to override it with real value.- Overrides:
 getValueClassin classValueInstantiator
 
- 
canCreateFromString
public boolean canCreateFromString()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a String-based creator is available for this instantiator.NOTE: does NOT include possible case of fallbacks, or coercion; only considers explicit creator.
- Overrides:
 canCreateFromStringin classValueInstantiator
 
- 
canCreateFromInt
public boolean canCreateFromInt()
Description copied from class:ValueInstantiatorMethod that can be called to check whether an integer (int, Integer) based creator is available to use (to callValueInstantiator.createFromInt(com.fasterxml.jackson.databind.DeserializationContext, int)).- Overrides:
 canCreateFromIntin classValueInstantiator
 
- 
canCreateFromLong
public boolean canCreateFromLong()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a long (long, Long) based creator is available to use (to callValueInstantiator.createFromLong(com.fasterxml.jackson.databind.DeserializationContext, long)).- Overrides:
 canCreateFromLongin classValueInstantiator
 
- 
canCreateFromBigInteger
public boolean canCreateFromBigInteger()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a BigInteger based creator is available to use (to callValueInstantiator.createFromBigInteger(com.fasterxml.jackson.databind.DeserializationContext, java.math.BigInteger)). +- Overrides:
 canCreateFromBigIntegerin classValueInstantiator
 
- 
canCreateFromDouble
public boolean canCreateFromDouble()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a double (double / Double) based creator is available to use (to callValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)).- Overrides:
 canCreateFromDoublein classValueInstantiator
 
- 
canCreateFromBigDecimal
public boolean canCreateFromBigDecimal()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a BigDecimal based creator is available to use (to callValueInstantiator.createFromBigDecimal(com.fasterxml.jackson.databind.DeserializationContext, java.math.BigDecimal)).- Overrides:
 canCreateFromBigDecimalin classValueInstantiator
 
- 
canCreateFromBoolean
public boolean canCreateFromBoolean()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a double (boolean / Boolean) based creator is available to use (to callValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)).- Overrides:
 canCreateFromBooleanin classValueInstantiator
 
- 
canCreateUsingDefault
public boolean canCreateUsingDefault()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a default creator (constructor, or no-arg static factory method) is available for this instantiator- Overrides:
 canCreateUsingDefaultin classValueInstantiator
 
- 
canCreateUsingDelegate
public boolean canCreateUsingDelegate()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a delegate-based creator (single-arg constructor or factory method) is available for this instantiator- Overrides:
 canCreateUsingDelegatein classValueInstantiator
 
- 
canCreateUsingArrayDelegate
public boolean canCreateUsingArrayDelegate()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a array-delegate-based creator (single-arg constructor or factory method) is available for this instantiator- Overrides:
 canCreateUsingArrayDelegatein classValueInstantiator
 
- 
canCreateFromObjectWith
public boolean canCreateFromObjectWith()
Description copied from class:ValueInstantiatorMethod that can be called to check whether a property-based creator (argument-taking constructor or factory method) is available to instantiate values from JSON Object- Overrides:
 canCreateFromObjectWithin classValueInstantiator
 
- 
canInstantiate
public boolean canInstantiate()
Description copied from class:ValueInstantiatorMethod that will return true if any ofcanCreateXxxmethod returns true: that is, if there is any way that an instance could be created.- Overrides:
 canInstantiatein classValueInstantiator
 
- 
getDelegateType
public JavaType getDelegateType(DeserializationConfig config)
Description copied from class:ValueInstantiatorMethod that can be used to determine what is the type of delegate type to use, if any; if no delegates are used, will return null. If non-null type is returned, deserializer will bind JSON into specified type (using standard deserializer for that type), and pass that to instantiator.- Overrides:
 getDelegateTypein classValueInstantiator
 
- 
getArrayDelegateType
public JavaType getArrayDelegateType(DeserializationConfig config)
Description copied from class:ValueInstantiatorMethod that can be used to determine what is the type of array delegate type to use, if any; if no delegates are used, will return null. If non-null type is returned, deserializer will bind JSON into specified type (using standard deserializer for that type), and pass that to instantiator.- Overrides:
 getArrayDelegateTypein classValueInstantiator
 
- 
getFromObjectArguments
public SettableBeanProperty[] getFromObjectArguments(DeserializationConfig config)
Description copied from class:ValueInstantiatorMethod called to determine types of instantiation arguments to use when creating instances with creator arguments (whenValueInstantiator.canCreateFromObjectWith()returns true). These arguments are bound from JSON, using specified property types to locate deserializers.NOTE: all properties will be of type
CreatorProperty.- Overrides:
 getFromObjectArgumentsin classValueInstantiator
 
- 
createUsingDefault
public java.lang.Object createUsingDefault(DeserializationContext ctxt) throws java.io.IOException
Description copied from class:ValueInstantiatorMethod called to create value instance from a JSON value when no data needs to passed to creator (constructor, factory method); typically this will call the default constructor of the value object. It will only be used if more specific creator methods are not applicable; hence "default".This method is called if
ValueInstantiator.getFromObjectArguments(com.fasterxml.jackson.databind.DeserializationConfig)returns null or empty List.- Overrides:
 createUsingDefaultin classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromObjectWith
public java.lang.Object createFromObjectWith(DeserializationContext ctxt, java.lang.Object[] args) throws java.io.IOException
Description copied from class:ValueInstantiatorMethod called to create value instance from JSON Object when instantiation arguments are passed; this is done, for example when passing information specified with "Creator" annotations.This method is called if
ValueInstantiator.getFromObjectArguments(com.fasterxml.jackson.databind.DeserializationConfig)returns a non-empty List of arguments.- Overrides:
 createFromObjectWithin classValueInstantiator- Throws:
 java.io.IOException
 
- 
createUsingDelegate
public java.lang.Object createUsingDelegate(DeserializationContext ctxt, java.lang.Object delegate) throws java.io.IOException
Description copied from class:ValueInstantiatorMethod to called to create value instance from JSON Object using an intermediate "delegate" value to pass to createor method- Overrides:
 createUsingDelegatein classValueInstantiator- Throws:
 java.io.IOException
 
- 
createUsingArrayDelegate
public java.lang.Object createUsingArrayDelegate(DeserializationContext ctxt, java.lang.Object delegate) throws java.io.IOException
Description copied from class:ValueInstantiatorMethod to called to create value instance from JSON Array using an intermediate "delegate" value to pass to createor method- Overrides:
 createUsingArrayDelegatein classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromString
public java.lang.Object createFromString(DeserializationContext ctxt, java.lang.String value) throws java.io.IOException
- Overrides:
 createFromStringin classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromInt
public java.lang.Object createFromInt(DeserializationContext ctxt, int value) throws java.io.IOException
- Overrides:
 createFromIntin classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromLong
public java.lang.Object createFromLong(DeserializationContext ctxt, long value) throws java.io.IOException
- Overrides:
 createFromLongin classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromBigInteger
public java.lang.Object createFromBigInteger(DeserializationContext ctxt, java.math.BigInteger value) throws java.io.IOException
- Overrides:
 createFromBigIntegerin classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromDouble
public java.lang.Object createFromDouble(DeserializationContext ctxt, double value) throws java.io.IOException
- Overrides:
 createFromDoublein classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromBigDecimal
public java.lang.Object createFromBigDecimal(DeserializationContext ctxt, java.math.BigDecimal value) throws java.io.IOException
- Overrides:
 createFromBigDecimalin classValueInstantiator- Throws:
 java.io.IOException
 
- 
createFromBoolean
public java.lang.Object createFromBoolean(DeserializationContext ctxt, boolean value) throws java.io.IOException
- Overrides:
 createFromBooleanin classValueInstantiator- Throws:
 java.io.IOException
 
- 
getDelegateCreator
public AnnotatedWithParams getDelegateCreator()
Description copied from class:ValueInstantiatorMethod that can be called to try to access member (constructor, static factory method) that is used as the "delegate creator". Note that implementations not required to return actual object they use (or, they may use some other instantiation) method. That is, even ifValueInstantiator.canCreateUsingDelegate()returns true, this method may return null .- Overrides:
 getDelegateCreatorin classValueInstantiator
 
- 
getArrayDelegateCreator
public AnnotatedWithParams getArrayDelegateCreator()
Description copied from class:ValueInstantiatorMethod that can be called to try to access member (constructor, static factory method) that is used as the "array delegate creator". Note that implementations not required to return actual object they use (or, they may use some other instantiation) method. That is, even ifValueInstantiator.canCreateUsingArrayDelegate()returns true, this method may return null .- Overrides:
 getArrayDelegateCreatorin classValueInstantiator
 
- 
getDefaultCreator
public AnnotatedWithParams getDefaultCreator()
Description copied from class:ValueInstantiatorMethod that can be called to try to access member (constructor, static factory method) that is used as the "default creator" (creator that is called without arguments; typically default [zero-argument] constructor of the type). Note that implementations not required to return actual object they use (or, they may use some other instantiation) method. That is, even ifValueInstantiator.canCreateUsingDefault()returns true, this method may return null .- Overrides:
 getDefaultCreatorin classValueInstantiator
 
- 
getWithArgsCreator
public AnnotatedWithParams getWithArgsCreator()
Description copied from class:ValueInstantiatorMethod that can be called to try to access member (constructor, static factory method) that is used as the "non-default creator" (constructor or factory method that takes one or more arguments). Note that implementations not required to return actual object they use (or, they may use some other instantiation) method. That is, even ifValueInstantiator.canCreateFromObjectWith()returns true, this method may return null .- Overrides:
 getWithArgsCreatorin classValueInstantiator
 
 - 
 
 -