public class ConstantValueInstantiator extends ValueInstantiator
ValueInstantiator
implementation that will simply return constant
Object
it is configured with. May be used as-is, or as base class to override
simplistic behavior further.ValueInstantiator.Base, ValueInstantiator.Gettable
Constructor and Description |
---|
ConstantValueInstantiator(Object value) |
Modifier and Type | Method and Description |
---|---|
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 |
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. |
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.
|
Class<?> |
getValueClass()
Accessor for raw (type-erased) type of instances to create.
|
_createFromStringFallbacks, canCreateFromBoolean, canCreateFromDouble, canCreateFromInt, canCreateFromLong, canCreateFromObjectWith, canCreateFromString, canCreateUsingArrayDelegate, canCreateUsingDelegate, createFromBoolean, createFromDouble, createFromInt, createFromLong, createFromObjectWith, createFromObjectWith, createFromString, createUsingArrayDelegate, createUsingDelegate, getArrayDelegateCreator, getArrayDelegateType, getDefaultCreator, getDelegateCreator, getDelegateType, getFromObjectArguments, getIncompleteParameter, getValueTypeDesc, getWithArgsCreator
protected final Object _value
public ConstantValueInstantiator(Object value)
public 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 ValueInstantiator
public boolean canInstantiate()
ValueInstantiator
canCreateXxx
method
returns true: that is, if there is any way that an instance could
be created.canInstantiate
in class ValueInstantiator
public boolean canCreateUsingDefault()
ValueInstantiator
canCreateUsingDefault
in class ValueInstantiator
public 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 ValueInstantiator
IOException
Copyright © 2019 JBoss by Red Hat. All rights reserved.