Class 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
    • Field Detail

      • _value

        protected final java.lang.Object _value
    • Constructor Detail

      • ConstantValueInstantiator

        public ConstantValueInstantiator​(java.lang.Object value)
    • Method Detail

      • getValueClass

        public java.lang.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