Class StdValueInstantiator
java.lang.Object
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.deser.ValueInstantiator
edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.deser.std.StdValueInstantiator
- All Implemented Interfaces:
Serializable
Default
ValueInstantiator
implementation, which supports
Creator methods that can be indicated by standard Jackson
annotations.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.deser.ValueInstantiator
ValueInstantiator.Base, ValueInstantiator.Delegating, ValueInstantiator.Gettable
-
Field Summary
Modifier and TypeFieldDescriptionprotected SettableBeanProperty[]
protected AnnotatedWithParams
protected JavaType
protected SettableBeanProperty[]
protected AnnotatedWithParams
Default (no-argument) constructor to use for instantiation (withcreateUsingDefault(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext)
)protected SettableBeanProperty[]
protected AnnotatedWithParams
protected JavaType
protected AnnotatedWithParams
protected AnnotatedWithParams
protected AnnotatedWithParams
protected AnnotatedWithParams
protected AnnotatedWithParams
protected AnnotatedWithParams
protected AnnotatedWithParams
protected final Class<?>
protected final String
Type of values that are instantiated; used for error reporting purposes.protected AnnotatedWithParams
-
Constructor Summary
ModifierConstructorDescriptionprotected
Copy-constructor that sub-classes can use when creating new instances by fluent-style constructionStdValueInstantiator
(DeserializationConfig config, JavaType valueType) StdValueInstantiator
(DeserializationConfig config, Class<?> valueType) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Method that can be called to check whether a BigDecimal based creator is available to use (to callValueInstantiator.createFromBigDecimal(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.math.BigDecimal)
).boolean
Method that can be called to check whether a BigInteger based creator is available to use (to callValueInstantiator.createFromBigInteger(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.math.BigInteger)
).boolean
Method that can be called to check whether a double (boolean / Boolean) based creator is available to use (to callValueInstantiator.createFromDouble(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, double)
).boolean
Method that can be called to check whether a double (double / Double) based creator is available to use (to callValueInstantiator.createFromDouble(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, double)
).boolean
Method that can be called to check whether an integer (int, Integer) based creator is available to use (to callValueInstantiator.createFromInt(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, int)
).boolean
Method that can be called to check whether a long (long, Long) based creator is available to use (to callValueInstantiator.createFromLong(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, long)
).boolean
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 Objectboolean
Method that can be called to check whether a String-based creator is available for this instantiator.boolean
Method that can be called to check whether a array-delegate-based creator (single-arg constructor or factory method) is available for this instantiatorboolean
Method that can be called to check whether a default creator (constructor, or no-arg static factory method) is available for this instantiatorboolean
Method that can be called to check whether a delegate-based creator (single-arg constructor or factory method) is available for this instantiatorboolean
Method that will return true if any ofcanCreateXxx
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
void
void
void
void
void
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
createFromBigDecimal
(DeserializationContext ctxt, BigDecimal value) createFromBigInteger
(DeserializationContext ctxt, BigInteger value) createFromBoolean
(DeserializationContext ctxt, boolean value) createFromDouble
(DeserializationContext ctxt, double value) createFromInt
(DeserializationContext ctxt, int value) createFromLong
(DeserializationContext ctxt, long value) 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.createFromString
(DeserializationContext ctxt, String value) createUsingArrayDelegate
(DeserializationContext ctxt, Object delegate) Method to called to create value instance from JSON Array using an intermediate "delegate" value to pass to createor methodMethod 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.createUsingDelegate
(DeserializationContext ctxt, Object delegate) Method to called to create value instance from JSON Object using an intermediate "delegate" value to pass to createor methodMethod that can be called to try to access member (constructor, static factory method) that is used as the "array delegate creator".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.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).Method that can be called to try to access member (constructor, static factory method) that is used as the "delegate creator".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.Method called to determine types of instantiation arguments to use when creating instances with creator arguments (whenValueInstantiator.canCreateFromObjectWith()
returns true).Class<?>
Accessor for raw (type-erased) type of instances to create.Method that returns description of the value type this instantiator handles.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
Method that subclasses may call for standard handling of an exception thrown when calling constructor or factory method.protected JsonMappingException
Deprecated.Since 2.7 call eitherrewrapCtorProblem(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
orwrapAsJsonMappingException(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
protected JsonMappingException
Helper method that will return givenThrowable
case as aJsonMappingException
(if it is of that type), or callDeserializationContext.instantiationException(Class, Throwable)
to produce and return suitableJsonMappingException
.protected JsonMappingException
Deprecated.Since 2.7 call eitherrewrapCtorProblem(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
orwrapAsJsonMappingException(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
Methods inherited from class edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.deser.ValueInstantiator
_createFromStringFallbacks, createContextual, createFromObjectWith
-
Field Details
-
_valueTypeDesc
Type of values that are instantiated; used for error reporting purposes. -
_valueClass
- Since:
- 2.8
-
_defaultCreator
Default (no-argument) constructor to use for instantiation (withcreateUsingDefault(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext)
) -
_withArgsCreator
-
_constructorArguments
-
_delegateType
-
_delegateCreator
-
_delegateArguments
-
_arrayDelegateType
-
_arrayDelegateCreator
-
_arrayDelegateArguments
-
_fromStringCreator
-
_fromIntCreator
-
_fromLongCreator
-
_fromBigIntegerCreator
-
_fromDoubleCreator
-
_fromBigDecimalCreator
-
_fromBooleanCreator
-
-
Constructor Details
-
StdValueInstantiator
Deprecated.Since 2.7 use constructor that takesJavaType
instead -
StdValueInstantiator
-
StdValueInstantiator
Copy-constructor that sub-classes can use when creating new instances by fluent-style construction
-
-
Method Details
-
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
-
configureFromIntCreator
-
configureFromLongCreator
-
configureFromBigIntegerCreator
-
configureFromDoubleCreator
-
configureFromBigDecimalCreator
-
configureFromBooleanCreator
-
getValueTypeDesc
Description copied from class:ValueInstantiator
Method that returns description of the value type this instantiator handles. Used for error messages, diagnostics.- Overrides:
getValueTypeDesc
in classValueInstantiator
-
getValueClass
Description copied from class:ValueInstantiator
Accessor 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:
getValueClass
in classValueInstantiator
-
canCreateFromString
public boolean canCreateFromString()Description copied from class:ValueInstantiator
Method 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:
canCreateFromString
in classValueInstantiator
-
canCreateFromInt
public boolean canCreateFromInt()Description copied from class:ValueInstantiator
Method that can be called to check whether an integer (int, Integer) based creator is available to use (to callValueInstantiator.createFromInt(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, int)
).- Overrides:
canCreateFromInt
in classValueInstantiator
-
canCreateFromLong
public boolean canCreateFromLong()Description copied from class:ValueInstantiator
Method that can be called to check whether a long (long, Long) based creator is available to use (to callValueInstantiator.createFromLong(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, long)
).- Overrides:
canCreateFromLong
in classValueInstantiator
-
canCreateFromBigInteger
public boolean canCreateFromBigInteger()Description copied from class:ValueInstantiator
Method that can be called to check whether a BigInteger based creator is available to use (to callValueInstantiator.createFromBigInteger(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.math.BigInteger)
). +- Overrides:
canCreateFromBigInteger
in classValueInstantiator
-
canCreateFromDouble
public boolean canCreateFromDouble()Description copied from class:ValueInstantiator
Method that can be called to check whether a double (double / Double) based creator is available to use (to callValueInstantiator.createFromDouble(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, double)
).- Overrides:
canCreateFromDouble
in classValueInstantiator
-
canCreateFromBigDecimal
public boolean canCreateFromBigDecimal()Description copied from class:ValueInstantiator
Method that can be called to check whether a BigDecimal based creator is available to use (to callValueInstantiator.createFromBigDecimal(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.math.BigDecimal)
).- Overrides:
canCreateFromBigDecimal
in classValueInstantiator
-
canCreateFromBoolean
public boolean canCreateFromBoolean()Description copied from class:ValueInstantiator
Method that can be called to check whether a double (boolean / Boolean) based creator is available to use (to callValueInstantiator.createFromDouble(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, double)
).- Overrides:
canCreateFromBoolean
in classValueInstantiator
-
canCreateUsingDefault
public boolean canCreateUsingDefault()Description copied from class:ValueInstantiator
Method that can be called to check whether a default creator (constructor, or no-arg static factory method) is available for this instantiator- Overrides:
canCreateUsingDefault
in classValueInstantiator
-
canCreateUsingDelegate
public boolean canCreateUsingDelegate()Description copied from class:ValueInstantiator
Method that can be called to check whether a delegate-based creator (single-arg constructor or factory method) is available for this instantiator- Overrides:
canCreateUsingDelegate
in classValueInstantiator
-
canCreateUsingArrayDelegate
public boolean canCreateUsingArrayDelegate()Description copied from class:ValueInstantiator
Method that can be called to check whether a array-delegate-based creator (single-arg constructor or factory method) is available for this instantiator- Overrides:
canCreateUsingArrayDelegate
in classValueInstantiator
-
canCreateFromObjectWith
public boolean canCreateFromObjectWith()Description copied from class:ValueInstantiator
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- Overrides:
canCreateFromObjectWith
in classValueInstantiator
-
canInstantiate
public boolean canInstantiate()Description copied from class:ValueInstantiator
Method that will return true if any ofcanCreateXxx
method returns true: that is, if there is any way that an instance could be created.- Overrides:
canInstantiate
in classValueInstantiator
-
getDelegateType
Description copied from class:ValueInstantiator
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. 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:
getDelegateType
in classValueInstantiator
-
getArrayDelegateType
Description copied from class:ValueInstantiator
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. 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:
getArrayDelegateType
in classValueInstantiator
-
getFromObjectArguments
Description copied from class:ValueInstantiator
Method 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:
getFromObjectArguments
in classValueInstantiator
-
createUsingDefault
Description copied from class:ValueInstantiator
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. It will only be used if more specific creator methods are not applicable; hence "default".This method is called if
ValueInstantiator.getFromObjectArguments(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationConfig)
returns null or empty List.- Overrides:
createUsingDefault
in classValueInstantiator
- Throws:
IOException
-
createFromObjectWith
Description copied from class:ValueInstantiator
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.This method is called if
ValueInstantiator.getFromObjectArguments(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationConfig)
returns a non-empty List of arguments.- Overrides:
createFromObjectWith
in classValueInstantiator
- Throws:
IOException
-
createUsingDelegate
Description copied from class:ValueInstantiator
Method to called to create value instance from JSON Object using an intermediate "delegate" value to pass to createor method- Overrides:
createUsingDelegate
in classValueInstantiator
- Throws:
IOException
-
createUsingArrayDelegate
public Object createUsingArrayDelegate(DeserializationContext ctxt, Object delegate) throws IOException Description copied from class:ValueInstantiator
Method to called to create value instance from JSON Array using an intermediate "delegate" value to pass to createor method- Overrides:
createUsingArrayDelegate
in classValueInstantiator
- Throws:
IOException
-
createFromString
- Overrides:
createFromString
in classValueInstantiator
- Throws:
IOException
-
createFromInt
- Overrides:
createFromInt
in classValueInstantiator
- Throws:
IOException
-
createFromLong
- Overrides:
createFromLong
in classValueInstantiator
- Throws:
IOException
-
createFromBigInteger
public Object createFromBigInteger(DeserializationContext ctxt, BigInteger value) throws IOException - Overrides:
createFromBigInteger
in classValueInstantiator
- Throws:
IOException
-
createFromDouble
- Overrides:
createFromDouble
in classValueInstantiator
- Throws:
IOException
-
createFromBigDecimal
public Object createFromBigDecimal(DeserializationContext ctxt, BigDecimal value) throws IOException - Overrides:
createFromBigDecimal
in classValueInstantiator
- Throws:
IOException
-
createFromBoolean
- Overrides:
createFromBoolean
in classValueInstantiator
- Throws:
IOException
-
getDelegateCreator
Description copied from class:ValueInstantiator
Method 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:
getDelegateCreator
in classValueInstantiator
-
getArrayDelegateCreator
Description copied from class:ValueInstantiator
Method 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:
getArrayDelegateCreator
in classValueInstantiator
-
getDefaultCreator
Description copied from class:ValueInstantiator
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). 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:
getDefaultCreator
in classValueInstantiator
-
getWithArgsCreator
Description copied from class:ValueInstantiator
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). 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:
getWithArgsCreator
in classValueInstantiator
-
wrapException
Deprecated.Since 2.7 call eitherrewrapCtorProblem(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
orwrapAsJsonMappingException(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
-
unwrapAndWrapException
@Deprecated protected JsonMappingException unwrapAndWrapException(DeserializationContext ctxt, Throwable t) Deprecated.Since 2.7 call eitherrewrapCtorProblem(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
orwrapAsJsonMappingException(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
-
wrapAsJsonMappingException
Helper method that will return givenThrowable
case as aJsonMappingException
(if it is of that type), or callDeserializationContext.instantiationException(Class, Throwable)
to produce and return suitableJsonMappingException
.- Since:
- 2.7
-
rewrapCtorProblem
Method that subclasses may call for standard handling of an exception thrown when calling constructor or factory method. Will unwrapExceptionInInitializerError
andInvocationTargetException
s, then callwrapAsJsonMappingException(edu.internet2.middleware.grouperClientExt.com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)
.- Since:
- 2.7
-
JavaType
instead