com.fasterxml.jackson.databind.util

## Class ConstantValueInstantiator

- java.lang.Object
- - com.fasterxml.jackson.databind.deser.ValueInstantiator
  - - com.fasterxml.jackson.databind.util.ConstantValueInstantiator

    public class ConstantValueInstantiator
    extends ValueInstantiator

Trivial `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.

Since:
  2.9.4

### Nested Class Summary

### Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.deser.ValueInstantiator

`ValueInstantiator.Base, ValueInstantiator.Gettable`

### Field Summary

Fields
`protected Object` `_value`

### Constructor Summary

Constructors
Constructor and Description
`ConstantValueInstantiator(Object value)`

### Method Summary

Methods
`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.

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

`_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`

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

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

### Field Detail

#### _value

    protected final Object _value

### Constructor Detail

#### ConstantValueInstantiator

    public ConstantValueInstantiator(Object value)

### Method Detail

#### getValueClass

    public Class<?> 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 class `ValueInstantiator`

#### canInstantiate

    public boolean canInstantiate()

Description copied from class: `ValueInstantiator`
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.

Overrides:
  `canInstantiate` 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`

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