com.fasterxml.jackson.databind.deser.std

## Class StdValueInstantiator

- java.lang.Object
- - com.fasterxml.jackson.databind.deser.ValueInstantiator
  - - com.fasterxml.jackson.databind.deser.std.StdValueInstantiator

- All Implemented Interfaces:
    Serializable

      public class StdValueInstantiator
      extends ValueInstantiator
      implements Serializable

  Default `ValueInstantiator` implementation, which supports Creator methods that can be indicated by standard Jackson annotations.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SettableBeanProperty[]` | `_arrayDelegateArguments`
    `protected AnnotatedWithParams` | `_arrayDelegateCreator`
    `protected JavaType` | `_arrayDelegateType`
    `protected SettableBeanProperty[]` | `_constructorArguments`
    `protected AnnotatedWithParams` | `_defaultCreator` Default (no-argument) constructor to use for instantiation (with `createUsingDefault(com.fasterxml.jackson.databind.DeserializationContext)`)
    `protected SettableBeanProperty[]` | `_delegateArguments`
    `protected AnnotatedWithParams` | `_delegateCreator`
    `protected JavaType` | `_delegateType`
    `protected AnnotatedWithParams` | `_fromBooleanCreator`
    `protected AnnotatedWithParams` | `_fromDoubleCreator`
    `protected AnnotatedWithParams` | `_fromIntCreator`
    `protected AnnotatedWithParams` | `_fromLongCreator`
    `protected AnnotatedWithParams` | `_fromStringCreator`
    `protected AnnotatedParameter` | `_incompleteParameter`
    `protected String` | `_valueTypeDesc` Type of values that are instantiated; used for error reporting purposes.
    `protected AnnotatedWithParams` | `_withArgsCreator`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `StdValueInstantiator(DeserializationConfig config, Class<?> valueType)`
    `` | `StdValueInstantiator(DeserializationConfig config, JavaType valueType)`
    `protected` | `StdValueInstantiator(StdValueInstantiator src)` Copy-constructor that sub-classes can use when creating new instances by fluent-style construction

  - ### Method Summary

    Methods
    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
    `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.
    `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)`
    `protected JsonMappingException` | `unwrapAndWrapException(DeserializationContext ctxt, Throwable t)`
    `protected JsonMappingException` | `wrapAsJsonMappingException(DeserializationContext ctxt, Throwable t)`
    `protected JsonMappingException` | `wrapException(Throwable t)` Deprecated. Since 2.7 call either `unwrapAndWrapException(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)` or `wrapAsJsonMappingException(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)`

    - ### Methods inherited from class com.fasterxml.jackson.databind.deser.ValueInstantiator

      `_createFromStringFallbacks, canInstantiate`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _valueTypeDesc

          protected final String _valueTypeDesc

      Type of values that are instantiated; used for error reporting purposes.

    - #### _defaultCreator

          protected AnnotatedWithParams _defaultCreator

      Default (no-argument) constructor to use for instantiation (with `createUsingDefault(com.fasterxml.jackson.databind.DeserializationContext)`)

    - #### _withArgsCreator

          protected AnnotatedWithParams _withArgsCreator

    - #### _constructorArguments

          protected SettableBeanProperty[] _constructorArguments

    - #### _delegateType

          protected JavaType _delegateType

    - #### _delegateCreator

          protected AnnotatedWithParams _delegateCreator

    - #### _delegateArguments

          protected SettableBeanProperty[] _delegateArguments

    - #### _arrayDelegateType

          protected JavaType _arrayDelegateType

    - #### _arrayDelegateCreator

          protected AnnotatedWithParams _arrayDelegateCreator

    - #### _arrayDelegateArguments

          protected SettableBeanProperty[] _arrayDelegateArguments

    - #### _fromStringCreator

          protected AnnotatedWithParams _fromStringCreator

    - #### _fromIntCreator

          protected AnnotatedWithParams _fromIntCreator

    - #### _fromLongCreator

          protected AnnotatedWithParams _fromLongCreator

    - #### _fromDoubleCreator

          protected AnnotatedWithParams _fromDoubleCreator

    - #### _fromBooleanCreator

          protected AnnotatedWithParams _fromBooleanCreator

    - #### _incompleteParameter

          protected AnnotatedParameter _incompleteParameter

  - ### Constructor Detail

    - #### StdValueInstantiator

          public StdValueInstantiator(DeserializationConfig config,
                              Class<?> valueType)

    - #### StdValueInstantiator

          public StdValueInstantiator(DeserializationConfig config,
                              JavaType valueType)

    - #### StdValueInstantiator

          protected StdValueInstantiator(StdValueInstantiator src)

      Copy-constructor that sub-classes can use when creating new instances by fluent-style construction

  - ### Method Detail

    - #### 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

          public void configureFromStringCreator(AnnotatedWithParams creator)

    - #### configureFromIntCreator

          public void configureFromIntCreator(AnnotatedWithParams creator)

    - #### configureFromLongCreator

          public void configureFromLongCreator(AnnotatedWithParams creator)

    - #### configureFromDoubleCreator

          public void configureFromDoubleCreator(AnnotatedWithParams creator)

    - #### configureFromBooleanCreator

          public void configureFromBooleanCreator(AnnotatedWithParams creator)

    - #### configureIncompleteParameter

          public void configureIncompleteParameter(AnnotatedParameter parameter)

    - #### getValueTypeDesc

          public String getValueTypeDesc()

      Description copied from class: `ValueInstantiator`
      Method that returns description of the value type this instantiator handles. Used for error messages, diagnostics.
      Specified by:
        `getValueTypeDesc` in class `ValueInstantiator`

    - #### 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
      Overrides:
        `canCreateFromString` in class `ValueInstantiator`

    - #### 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 call `ValueInstantiator.createFromInt(com.fasterxml.jackson.databind.DeserializationContext, int)`).
      Overrides:
        `canCreateFromInt` in class `ValueInstantiator`

    - #### 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 call `ValueInstantiator.createFromLong(com.fasterxml.jackson.databind.DeserializationContext, long)`).
      Overrides:
        `canCreateFromLong` in class `ValueInstantiator`

    - #### 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 call `ValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)`).
      Overrides:
        `canCreateFromDouble` in class `ValueInstantiator`

    - #### 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 call `ValueInstantiator.createFromDouble(com.fasterxml.jackson.databind.DeserializationContext, double)`).
      Overrides:
        `canCreateFromBoolean` in class `ValueInstantiator`

    - #### 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 class `ValueInstantiator`

    - #### 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 class `ValueInstantiator`

    - #### 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 class `ValueInstantiator`

    - #### 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 class `ValueInstantiator`

    - #### getDelegateType

          public JavaType getDelegateType(DeserializationConfig config)

      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 class `ValueInstantiator`

    - #### getArrayDelegateType

          public JavaType getArrayDelegateType(DeserializationConfig config)

      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 class `ValueInstantiator`

    - #### getFromObjectArguments

          public SettableBeanProperty[] getFromObjectArguments(DeserializationConfig config)

      Description copied from class: `ValueInstantiator`
      Method called to determine types of instantiation arguments to use when creating instances with creator arguments (when `ValueInstantiator.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 class `ValueInstantiator`

    - #### createUsingDefault

          public Object createUsingDefault(DeserializationContext ctxt)
                                    throws IOException

      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(com.fasterxml.jackson.databind.DeserializationConfig)` returns null or empty List.

      Overrides:
        `createUsingDefault` in class `ValueInstantiator`
      Throws:
        `IOException`

    - #### createFromObjectWith

          public Object createFromObjectWith(DeserializationContext ctxt,
                                    Object[] args)
                                      throws IOException

      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(com.fasterxml.jackson.databind.DeserializationConfig)` returns a non-empty List of arguments.

      Overrides:
        `createFromObjectWith` in class `ValueInstantiator`
      Throws:
        `IOException`

    - #### createUsingDelegate

          public Object createUsingDelegate(DeserializationContext ctxt,
                                   Object delegate)
                                     throws IOException

      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 class `ValueInstantiator`
      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 class `ValueInstantiator`
      Throws:
        `IOException`

    - #### createFromString

          public Object createFromString(DeserializationContext ctxt,
                                String value)
                                  throws IOException

      Overrides:
        `createFromString` in class `ValueInstantiator`
      Throws:
        `IOException`

    - #### createFromInt

          public Object createFromInt(DeserializationContext ctxt,
                             int value)
                               throws IOException

      Overrides:
        `createFromInt` in class `ValueInstantiator`
      Throws:
        `IOException`

    - #### createFromLong

          public Object createFromLong(DeserializationContext ctxt,
                              long value)
                                throws IOException

      Overrides:
        `createFromLong` in class `ValueInstantiator`
      Throws:
        `IOException`

    - #### createFromDouble

          public Object createFromDouble(DeserializationContext ctxt,
                                double value)
                                  throws IOException

      Overrides:
        `createFromDouble` in class `ValueInstantiator`
      Throws:
        `IOException`

    - #### createFromBoolean

          public Object createFromBoolean(DeserializationContext ctxt,
                                 boolean value)
                                   throws IOException

      Overrides:
        `createFromBoolean` in class `ValueInstantiator`
      Throws:
        `IOException`

    - #### getDelegateCreator

          public AnnotatedWithParams 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 if `ValueInstantiator.canCreateUsingDelegate()` returns true, this method may return null .
      Overrides:
        `getDelegateCreator` in class `ValueInstantiator`

    - #### getArrayDelegateCreator

          public AnnotatedWithParams 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 if `ValueInstantiator.canCreateUsingArrayDelegate()` returns true, this method may return null .
      Overrides:
        `getArrayDelegateCreator` in class `ValueInstantiator`

    - #### getDefaultCreator

          public AnnotatedWithParams 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 if `ValueInstantiator.canCreateUsingDefault()` returns true, this method may return null .
      Overrides:
        `getDefaultCreator` in class `ValueInstantiator`

    - #### getWithArgsCreator

          public AnnotatedWithParams 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 if `ValueInstantiator.canCreateFromObjectWith()` returns true, this method may return null .
      Overrides:
        `getWithArgsCreator` in class `ValueInstantiator`

    - #### getIncompleteParameter

          public AnnotatedParameter getIncompleteParameter()

      Description copied from class: `ValueInstantiator`
      If an incomplete creator was found, this is the first parameter that needs further annotation to help make the creator complete.
      Overrides:
        `getIncompleteParameter` in class `ValueInstantiator`

    - #### wrapException

          @Deprecated
          protected JsonMappingException wrapException(Throwable t)

      Deprecated. Since 2.7 call either `unwrapAndWrapException(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)` or `wrapAsJsonMappingException(com.fasterxml.jackson.databind.DeserializationContext, java.lang.Throwable)`

    - #### unwrapAndWrapException

          protected JsonMappingException unwrapAndWrapException(DeserializationContext ctxt,
                                                    Throwable t)

      Since:
        2.7

    - #### wrapAsJsonMappingException

          protected JsonMappingException wrapAsJsonMappingException(DeserializationContext ctxt,
                                                        Throwable t)

      Since:
        2.7

    - #### rewrapCtorProblem

          protected JsonMappingException rewrapCtorProblem(DeserializationContext ctxt,
                                               Throwable t)

      Since:
        2.7

Copyright © 2008–2016 FasterXML. All rights reserved.