Class ValueInstantiator.Delegating
- java.lang.Object
-
- com.fasterxml.jackson.databind.deser.ValueInstantiator
-
- com.fasterxml.jackson.databind.deser.ValueInstantiator.Delegating
-
- All Implemented Interfaces:
java.io.Serializable
- Enclosing class:
- ValueInstantiator
public static class ValueInstantiator.Delegating extends ValueInstantiator implements java.io.Serializable
DelegatingValueInstantiatorimplementation meant as a base type that by default delegates methods to specified fallback instantiator.- Since:
- 2.12
- 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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.ValueInstantiatorcreateContextual(DeserializationContext ctxt, BeanDescription beanDesc)"Contextualization" method that is called after construction but before first use, to allow instantiator access to context needed to possible resolve its dependencies.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, SettableBeanProperty[] props, PropertyValueBuffer buffer)Method that delegates toValueInstantiator.createFromObjectWith(DeserializationContext, Object[])by default, but can be overridden if the application should have customized behavior with respect to missing properties.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
canCreateFromBigDecimal, canCreateFromBigInteger, createUsingDefaultOrWithoutArguments
-
-
-
-
Method Detail
-
createContextual
public ValueInstantiator createContextual(DeserializationContext ctxt, BeanDescription beanDesc) throws JsonMappingException
Description copied from class:ValueInstantiator"Contextualization" method that is called after construction but before first use, to allow instantiator access to context needed to possible resolve its dependencies.- Overrides:
createContextualin classValueInstantiator- Parameters:
ctxt- Currently active deserialization context: needed to (for example) resolvingTypeDeserializers.- Returns:
- This instance, if no change, or newly constructed instance
- Throws:
JsonMappingException- If there are issues with contextualization
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
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
-
createFromObjectWith
public java.lang.Object createFromObjectWith(DeserializationContext ctxt, SettableBeanProperty[] props, PropertyValueBuffer buffer) throws java.io.IOException
Description copied from class:ValueInstantiatorMethod that delegates toValueInstantiator.createFromObjectWith(DeserializationContext, Object[])by default, but can be overridden if the application should have customized behavior with respect to missing properties.The default implementation of this method uses
PropertyValueBuffer.getParameters(SettableBeanProperty[])to read and validate all properties in bulk, possibly substituting defaults for missing properties or throwing exceptions for missing properties. An overridden implementation of this method could, for example, usePropertyValueBuffer.hasParameter(SettableBeanProperty)andPropertyValueBuffer.getParameter(SettableBeanProperty)to safely read the present properties only, and to have some other behavior for the missing properties.- 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
-
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
-
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
-
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
-
-