public abstract class ValueInstantiator
extends java.lang.Object
Note that this type is not parameterized (even though it would seemingly
make sense), because such type information cannot be use effectively
during runtime: access is always using either wildcard type, or just
basic Object
; and so adding type parameter seems
like unnecessary extra work.
Actual implementations are strongly recommended to be based on
StdValueInstantiator
which implements all methods, and as such will be compatible
across versions even if new methods were added to this interface.
Modifier and Type | Class and Description |
---|---|
static class |
ValueInstantiator.Base
Partial
ValueInstantiator implementation that is strongly recommended
to be used instead of directly extending ValueInstantiator itself. |
static interface |
ValueInstantiator.Gettable |
Constructor and Description |
---|
ValueInstantiator() |
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
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
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
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
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. |
java.lang.Object |
createFromBoolean(DeserializationContext ctxt,
boolean value) |
java.lang.Object |
createFromDouble(DeserializationContext ctxt,
double value) |
java.lang.Object |
createFromInt(DeserializationContext ctxt,
int value) |
java.lang.Object |
createFromLong(DeserializationContext ctxt,
long value) |
java.lang.Object |
createFromObjectWith(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.Object |
createFromObjectWith(DeserializationContext ctxt,
SettableBeanProperty[] props,
PropertyValueBuffer buffer)
Method that delegates to
createFromObjectWith(DeserializationContext, Object[]) by
default, but can be overridden if the application should have customized
behavior with respect to missing properties. |
java.lang.Object |
createFromString(DeserializationContext ctxt,
java.lang.String value) |
java.lang.Object |
createUsingArrayDelegate(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 method
|
java.lang.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.
|
java.lang.Object |
createUsingDelegate(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 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
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.
|
java.lang.Class<?> |
getValueClass()
Accessor for raw (type-erased) type of instances to create.
|
java.lang.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).
|
public java.lang.Class<?> getValueClass()
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.
public java.lang.String getValueTypeDesc()
public boolean canInstantiate()
canCreateXxx
method
returns true: that is, if there is any way that an instance could
be created.public boolean canCreateFromString()
public boolean canCreateFromInt()
createFromInt(com.fasterxml.jackson.databind.DeserializationContext, int)
).public boolean canCreateFromLong()
createFromLong(com.fasterxml.jackson.databind.DeserializationContext, long)
).public boolean canCreateFromDouble()
createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)
).public boolean canCreateFromBoolean()
createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)
).public boolean canCreateUsingDefault()
public boolean canCreateUsingDelegate()
public boolean canCreateUsingArrayDelegate()
public boolean canCreateFromObjectWith()
public SettableBeanProperty[] getFromObjectArguments(DeserializationConfig config)
canCreateFromObjectWith()
returns true).
These arguments are bound from JSON, using specified
property types to locate deserializers.
NOTE: all properties will be of type
CreatorProperty
.
public JavaType getDelegateType(DeserializationConfig config)
public JavaType getArrayDelegateType(DeserializationConfig config)
public java.lang.Object createUsingDefault(DeserializationContext ctxt) throws java.io.IOException
This method is called if getFromObjectArguments(com.fasterxml.jackson.databind.DeserializationConfig)
returns
null or empty List.
java.io.IOException
public java.lang.Object createFromObjectWith(DeserializationContext ctxt, java.lang.Object[] args) throws java.io.IOException
This method is called if getFromObjectArguments(com.fasterxml.jackson.databind.DeserializationConfig)
returns
a non-empty List of arguments.
java.io.IOException
public java.lang.Object createFromObjectWith(DeserializationContext ctxt, SettableBeanProperty[] props, PropertyValueBuffer buffer) throws java.io.IOException
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, use
PropertyValueBuffer.hasParameter(SettableBeanProperty)
and
PropertyValueBuffer.getParameter(SettableBeanProperty)
to safely
read the present properties only, and to have some other behavior for the
missing properties.
java.io.IOException
public java.lang.Object createUsingDelegate(DeserializationContext ctxt, java.lang.Object delegate) throws java.io.IOException
java.io.IOException
public java.lang.Object createUsingArrayDelegate(DeserializationContext ctxt, java.lang.Object delegate) throws java.io.IOException
java.io.IOException
public java.lang.Object createFromString(DeserializationContext ctxt, java.lang.String value) throws java.io.IOException
java.io.IOException
public java.lang.Object createFromInt(DeserializationContext ctxt, int value) throws java.io.IOException
java.io.IOException
public java.lang.Object createFromLong(DeserializationContext ctxt, long value) throws java.io.IOException
java.io.IOException
public java.lang.Object createFromDouble(DeserializationContext ctxt, double value) throws java.io.IOException
java.io.IOException
public java.lang.Object createFromBoolean(DeserializationContext ctxt, boolean value) throws java.io.IOException
java.io.IOException
public AnnotatedWithParams getDefaultCreator()
canCreateUsingDefault()
returns true,
this method may return null .public AnnotatedWithParams getDelegateCreator()
canCreateUsingDelegate()
returns true,
this method may return null .public AnnotatedWithParams getArrayDelegateCreator()
canCreateUsingArrayDelegate()
returns true,
this method may return null .public AnnotatedWithParams getWithArgsCreator()
canCreateFromObjectWith()
returns true,
this method may return null .public AnnotatedParameter getIncompleteParameter()
Copyright © 2010 - 2020 Adobe. All Rights Reserved