public class StdValueInstantiator extends ValueInstantiator implements Serializable
ValueInstantiator implementation, which supports
Creator methods that can be indicated by standard Jackson
annotations.ValueInstantiator.Base, ValueInstantiator.Gettable| Modifier | Constructor and Description |
|---|---|
|
StdValueInstantiator(DeserializationConfig config,
Class<?> valueType)
Deprecated.
Since 2.7 use constructor that takes
JavaType instead |
|
StdValueInstantiator(DeserializationConfig config,
JavaType valueType) |
protected |
StdValueInstantiator(StdValueInstantiator src)
Copy-constructor that sub-classes can use when creating new instances
by fluent-style construction
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canCreateFromBoolean()
Method that can be called to check whether a double (boolean / Boolean) based
creator is available to use (to call
ValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)). |
boolean |
canCreateFromDouble()
Method that can be called to check whether a double (double / Double) based
creator is available to use (to call
ValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)). |
boolean |
canCreateFromInt()
Method that can be called to check whether an integer (int, Integer) based
creator is available to use (to call
ValueInstantiator.createFromInt(com.fasterxml.jackson.databind.DeserializationContext, int)). |
boolean |
canCreateFromLong()
Method that can be called to check whether a long (long, Long) based
creator is available to use (to call
ValueInstantiator.createFromLong(com.fasterxml.jackson.databind.DeserializationContext, long)). |
boolean |
canCreateFromObjectWith()
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 Object
|
boolean |
canCreateFromString()
Method that can be called to check whether a String-based creator
is available for this instantiator
|
boolean |
canCreateUsingArrayDelegate()
Method that can be called to check whether a array-delegate-based creator
(single-arg constructor or factory method)
is available for this instantiator
|
boolean |
canCreateUsingDefault()
Method that can be called to check whether a default creator (constructor,
or no-arg static factory method)
is available for this instantiator
|
boolean |
canCreateUsingDelegate()
Method that can be called to check whether a delegate-based creator (single-arg
constructor or factory method)
is available for this instantiator
|
boolean |
canInstantiate()
Method that will return true if any of
canCreateXxx method
returns true: that is, if there is any way that an instance could
be created. |
void |
configureFromArraySettings(AnnotatedWithParams arrayDelegateCreator,
JavaType arrayDelegateType,
SettableBeanProperty[] arrayDelegateArgs) |
void |
configureFromBooleanCreator(AnnotatedWithParams creator) |
void |
configureFromDoubleCreator(AnnotatedWithParams creator) |
void |
configureFromIntCreator(AnnotatedWithParams creator) |
void |
configureFromLongCreator(AnnotatedWithParams creator) |
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.
|
void |
configureFromStringCreator(AnnotatedWithParams creator) |
void |
configureIncompleteParameter(AnnotatedParameter parameter) |
Object |
createFromBoolean(DeserializationContext ctxt,
boolean value) |
Object |
createFromDouble(DeserializationContext ctxt,
double value) |
Object |
createFromInt(DeserializationContext ctxt,
int value) |
Object |
createFromLong(DeserializationContext ctxt,
long value) |
Object |
createFromObjectWith(DeserializationContext ctxt,
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.
|
Object |
createFromString(DeserializationContext ctxt,
String value) |
Object |
createUsingArrayDelegate(DeserializationContext ctxt,
Object delegate)
Method to called to create value instance from JSON Array using
an intermediate "delegate" value to pass to createor method
|
Object |
createUsingDefault(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.
|
Object |
createUsingDelegate(DeserializationContext ctxt,
Object delegate)
Method to called to create value instance from JSON Object using
an intermediate "delegate" value to pass to createor method
|
AnnotatedWithParams |
getArrayDelegateCreator()
Method that can be called to try to access member (constructor,
static factory method) that is used as the "array delegate creator".
|
JavaType |
getArrayDelegateType(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.
|
AnnotatedWithParams |
getDefaultCreator()
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).
|
AnnotatedWithParams |
getDelegateCreator()
Method that can be called to try to access member (constructor,
static factory method) that is used as the "delegate creator".
|
JavaType |
getDelegateType(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
(when
ValueInstantiator.canCreateFromObjectWith() returns true). |
AnnotatedParameter |
getIncompleteParameter()
If an incomplete creator was found, this is the first parameter that
needs further annotation to help make the creator complete.
|
Class<?> |
getValueClass()
Accessor for raw (type-erased) type of instances to create.
|
String |
getValueTypeDesc()
Method that returns description of the value type this instantiator
handles.
|
AnnotatedWithParams |
getWithArgsCreator()
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).
|
protected JsonMappingException |
rewrapCtorProblem(DeserializationContext ctxt,
Throwable t)
Method that subclasses may call for standard handling of an exception thrown when
calling constructor or factory method.
|
protected JsonMappingException |
unwrapAndWrapException(DeserializationContext ctxt,
Throwable t)
|
protected JsonMappingException |
wrapAsJsonMappingException(DeserializationContext ctxt,
Throwable t)
Helper method that will return given
Throwable case as
a JsonMappingException (if it is of that type), or call
DeserializationContext.instantiationException(Class, Throwable) to
produce and return suitable JsonMappingException. |
protected JsonMappingException |
wrapException(Throwable t)
|
_createFromStringFallbacks, createFromObjectWithprotected final String _valueTypeDesc
protected final Class<?> _valueClass
protected AnnotatedWithParams _defaultCreator
createUsingDefault(com.fasterxml.jackson.databind.DeserializationContext))protected AnnotatedWithParams _withArgsCreator
protected SettableBeanProperty[] _constructorArguments
protected JavaType _delegateType
protected AnnotatedWithParams _delegateCreator
protected SettableBeanProperty[] _delegateArguments
protected JavaType _arrayDelegateType
protected AnnotatedWithParams _arrayDelegateCreator
protected SettableBeanProperty[] _arrayDelegateArguments
protected AnnotatedWithParams _fromStringCreator
protected AnnotatedWithParams _fromIntCreator
protected AnnotatedWithParams _fromLongCreator
protected AnnotatedWithParams _fromDoubleCreator
protected AnnotatedWithParams _fromBooleanCreator
protected AnnotatedParameter _incompleteParameter
@Deprecated public StdValueInstantiator(DeserializationConfig config, Class<?> valueType)
JavaType insteadpublic StdValueInstantiator(DeserializationConfig config, JavaType valueType)
protected StdValueInstantiator(StdValueInstantiator src)
public void configureFromObjectSettings(AnnotatedWithParams defaultCreator, AnnotatedWithParams delegateCreator, JavaType delegateType, SettableBeanProperty[] delegateArgs, AnnotatedWithParams withArgsCreator, SettableBeanProperty[] constructorArgs)
public void configureFromArraySettings(AnnotatedWithParams arrayDelegateCreator, JavaType arrayDelegateType, SettableBeanProperty[] arrayDelegateArgs)
public void configureFromStringCreator(AnnotatedWithParams creator)
public void configureFromIntCreator(AnnotatedWithParams creator)
public void configureFromLongCreator(AnnotatedWithParams creator)
public void configureFromDoubleCreator(AnnotatedWithParams creator)
public void configureFromBooleanCreator(AnnotatedWithParams creator)
public void configureIncompleteParameter(AnnotatedParameter parameter)
public String getValueTypeDesc()
ValueInstantiatorgetValueTypeDesc in class ValueInstantiatorpublic Class<?> getValueClass()
ValueInstantiator
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.
getValueClass in class ValueInstantiatorpublic boolean canCreateFromString()
ValueInstantiatorcanCreateFromString in class ValueInstantiatorpublic boolean canCreateFromInt()
ValueInstantiatorValueInstantiator.createFromInt(com.fasterxml.jackson.databind.DeserializationContext, int)).canCreateFromInt in class ValueInstantiatorpublic boolean canCreateFromLong()
ValueInstantiatorValueInstantiator.createFromLong(com.fasterxml.jackson.databind.DeserializationContext, long)).canCreateFromLong in class ValueInstantiatorpublic boolean canCreateFromDouble()
ValueInstantiatorValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)).canCreateFromDouble in class ValueInstantiatorpublic boolean canCreateFromBoolean()
ValueInstantiatorValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)).canCreateFromBoolean in class ValueInstantiatorpublic boolean canCreateUsingDefault()
ValueInstantiatorcanCreateUsingDefault in class ValueInstantiatorpublic boolean canCreateUsingDelegate()
ValueInstantiatorcanCreateUsingDelegate in class ValueInstantiatorpublic boolean canCreateUsingArrayDelegate()
ValueInstantiatorcanCreateUsingArrayDelegate in class ValueInstantiatorpublic boolean canCreateFromObjectWith()
ValueInstantiatorcanCreateFromObjectWith in class ValueInstantiatorpublic boolean canInstantiate()
ValueInstantiatorcanCreateXxx method
returns true: that is, if there is any way that an instance could
be created.canInstantiate in class ValueInstantiatorpublic JavaType getDelegateType(DeserializationConfig config)
ValueInstantiatorgetDelegateType in class ValueInstantiatorpublic JavaType getArrayDelegateType(DeserializationConfig config)
ValueInstantiatorgetArrayDelegateType in class ValueInstantiatorpublic SettableBeanProperty[] getFromObjectArguments(DeserializationConfig config)
ValueInstantiatorValueInstantiator.canCreateFromObjectWith() returns true).
These arguments are bound from JSON, using specified
property types to locate deserializers.
NOTE: all properties will be of type
CreatorProperty.
getFromObjectArguments in class ValueInstantiatorpublic Object createUsingDefault(DeserializationContext ctxt) throws IOException
ValueInstantiator
This method is called if ValueInstantiator.getFromObjectArguments(com.fasterxml.jackson.databind.DeserializationConfig) returns
null or empty List.
createUsingDefault in class ValueInstantiatorIOExceptionpublic Object createFromObjectWith(DeserializationContext ctxt, Object[] args) throws IOException
ValueInstantiator
This method is called if ValueInstantiator.getFromObjectArguments(com.fasterxml.jackson.databind.DeserializationConfig) returns
a non-empty List of arguments.
createFromObjectWith in class ValueInstantiatorIOExceptionpublic Object createUsingDelegate(DeserializationContext ctxt, Object delegate) throws IOException
ValueInstantiatorcreateUsingDelegate in class ValueInstantiatorIOExceptionpublic Object createUsingArrayDelegate(DeserializationContext ctxt, Object delegate) throws IOException
ValueInstantiatorcreateUsingArrayDelegate in class ValueInstantiatorIOExceptionpublic Object createFromString(DeserializationContext ctxt, String value) throws IOException
createFromString in class ValueInstantiatorIOExceptionpublic Object createFromInt(DeserializationContext ctxt, int value) throws IOException
createFromInt in class ValueInstantiatorIOExceptionpublic Object createFromLong(DeserializationContext ctxt, long value) throws IOException
createFromLong in class ValueInstantiatorIOExceptionpublic Object createFromDouble(DeserializationContext ctxt, double value) throws IOException
createFromDouble in class ValueInstantiatorIOExceptionpublic Object createFromBoolean(DeserializationContext ctxt, boolean value) throws IOException
createFromBoolean in class ValueInstantiatorIOExceptionpublic AnnotatedWithParams getDelegateCreator()
ValueInstantiatorValueInstantiator.canCreateUsingDelegate() returns true,
this method may return null .getDelegateCreator in class ValueInstantiatorpublic AnnotatedWithParams getArrayDelegateCreator()
ValueInstantiatorValueInstantiator.canCreateUsingArrayDelegate() returns true,
this method may return null .getArrayDelegateCreator in class ValueInstantiatorpublic AnnotatedWithParams getDefaultCreator()
ValueInstantiatorValueInstantiator.canCreateUsingDefault() returns true,
this method may return null .getDefaultCreator in class ValueInstantiatorpublic AnnotatedWithParams getWithArgsCreator()
ValueInstantiatorValueInstantiator.canCreateFromObjectWith() returns true,
this method may return null .getWithArgsCreator in class ValueInstantiatorpublic AnnotatedParameter getIncompleteParameter()
ValueInstantiatorgetIncompleteParameter in class ValueInstantiator@Deprecated protected JsonMappingException wrapException(Throwable t)
@Deprecated protected JsonMappingException unwrapAndWrapException(DeserializationContext ctxt, Throwable t)
protected JsonMappingException wrapAsJsonMappingException(DeserializationContext ctxt, Throwable t)
Throwable case as
a JsonMappingException (if it is of that type), or call
DeserializationContext.instantiationException(Class, Throwable) to
produce and return suitable JsonMappingException.protected JsonMappingException rewrapCtorProblem(DeserializationContext ctxt, Throwable t)
ExceptionInInitializerError
and InvocationTargetExceptions, then call wrapAsJsonMappingException(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable).Copyright © 2008–2019 FasterXML. All rights reserved.