com.fasterxml.jackson.databind.type

## Class ReferenceType

- java.lang.Object
- - com.fasterxml.jackson.core.type.ResolvedType
  - - com.fasterxml.jackson.databind.JavaType
    - - com.fasterxml.jackson.databind.type.TypeBase
      - - com.fasterxml.jackson.databind.type.SimpleType
        - - com.fasterxml.jackson.databind.type.ReferenceType

All Implemented Interfaces:
  JsonSerializable, Serializable, Type

    public class ReferenceType
    extends SimpleType

Specialized `SimpleType` for types that are referential types, that is, values that can be dereferenced to another value (or null), of different type. Referenced type is accessible using `JavaType.getContentType()`.

Since:
  2.6
See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.JsonSerializable

`JsonSerializable.Base`

### Field Summary

Fields
`protected JavaType` `_referencedType`

### Fields inherited from class com.fasterxml.jackson.databind.type.SimpleType

`_typeNames, _typeParameters, _typeParametersFor`

### Fields inherited from class com.fasterxml.jackson.databind.JavaType

`_asStatic, _class, _hash, _typeHandler, _valueHandler`

### Constructor Summary

Constructors
`protected` `ReferenceType(Class<?> cls, JavaType refType, Object valueHandler, Object typeHandler, boolean asStatic)`

### Method Summary

Methods
`protected JavaType` `_narrow(Class<?> subclass)`
`protected String` `buildCanonicalName()`
`static ReferenceType` `construct(Class<?> cls, JavaType refType, Object valueHandler, Object typeHandler)`
`JavaType` `containedType(int index)`
`int` `containedTypeCount()`
`String` `containedTypeName(int index)`
`boolean` `equals(Object o)`
`StringBuilder` `getErasedSignature(StringBuilder sb)` Method for accessing signature without generic type information, in form compatible with all versions of JVM, and specifically used for type descriptions when generating byte code.
`StringBuilder` `getGenericSignature(StringBuilder sb)`
`Class<?>` `getParameterSource()`
`JavaType` `getReferencedType()`
`boolean` `isReferenceType()`
`String` `toString()`
`ReferenceType` `withContentTypeHandler(Object h)` "Copy method" that will construct a new instance that is identical to this instance, except that its content type will have specified type handler assigned.
`ReferenceType` `withContentValueHandler(Object h)` "Copy method" that will construct a new instance that is identical to this instance, except that it will have specified content value handler assigned.
`ReferenceType` `withStaticTyping()` Method that can be called to get a type instance that indicates that values of the type should be handled using "static typing" for purposes of serialization (as opposed to "dynamic" aka runtime typing): meaning that no runtime information is needed for determining serializers to use.
`ReferenceType` `withTypeHandler(Object h)` "Copy method" that will construct a new instance that is identical to this instance, except that it will have specified type handler assigned.
`ReferenceType` `withValueHandler(Object h)` "Copy method" that will construct a new instance that is identical to this instance, except that it will have specified value handler assigned.

### Methods inherited from class com.fasterxml.jackson.databind.type.SimpleType

`construct, constructUnsafe, isContainerType, narrowContentsBy, widenContentsBy`

### Methods inherited from class com.fasterxml.jackson.databind.type.TypeBase

`_classSignature, getTypeHandler, getValueHandler, serialize, serializeWithType, toCanonical`

### Methods inherited from class com.fasterxml.jackson.databind.JavaType

`_assertSubclass, _widen, containedTypeOrUnknown, forcedNarrowBy, getContentType, getErasedSignature, getGenericSignature, getKeyType, getRawClass, hasGenericTypes, hashCode, hasRawClass, hasValueHandler, isAbstract, isArrayType, isCollectionLikeType, isConcrete, isEnumType, isFinal, isInterface, isJavaLangObject, isMapLikeType, isPrimitive, isThrowable, isTypeOrSubTypeOf, narrowBy, useStaticType, widenBy`

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

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### _referencedType

    protected final JavaType _referencedType

### Constructor Detail

#### ReferenceType

    protected ReferenceType(Class<?> cls,
                 JavaType refType,
                 Object valueHandler,
                 Object typeHandler,
                 boolean asStatic)

### Method Detail

#### construct

    public static ReferenceType construct(Class<?> cls,
                          JavaType refType,
                          Object valueHandler,
                          Object typeHandler)

#### withTypeHandler

    public ReferenceType withTypeHandler(Object h)

Description copied from class: `JavaType`
"Copy method" that will construct a new instance that is identical to this instance, except that it will have specified type handler assigned.

Overrides:
  `withTypeHandler` in class `SimpleType`
Returns:
  Newly created type instance

#### withContentTypeHandler

    public ReferenceType withContentTypeHandler(Object h)

Description copied from class: `JavaType`
"Copy method" that will construct a new instance that is identical to this instance, except that its content type will have specified type handler assigned.

Overrides:
  `withContentTypeHandler` in class `SimpleType`
Returns:
  Newly created type instance

#### withValueHandler

    public ReferenceType withValueHandler(Object h)

Description copied from class: `JavaType`
"Copy method" that will construct a new instance that is identical to this instance, except that it will have specified value handler assigned.

Overrides:
  `withValueHandler` in class `SimpleType`
Returns:
  Newly created type instance

#### withContentValueHandler

    public ReferenceType withContentValueHandler(Object h)

Description copied from class: `JavaType`
"Copy method" that will construct a new instance that is identical to this instance, except that it will have specified content value handler assigned.

Overrides:
  `withContentValueHandler` in class `SimpleType`
Returns:
  Newly created type instance

#### withStaticTyping

    public ReferenceType withStaticTyping()

Description copied from class: `JavaType`
Method that can be called to get a type instance that indicates that values of the type should be handled using "static typing" for purposes of serialization (as opposed to "dynamic" aka runtime typing): meaning that no runtime information is needed for determining serializers to use. The main use case is to allow forcing of specific root value serialization type, and specifically in resolving serializers for contained types (element types for arrays, Collections and Maps).

Overrides:
  `withStaticTyping` in class `SimpleType`

#### buildCanonicalName

    protected String buildCanonicalName()

Overrides:
  `buildCanonicalName` in class `SimpleType`

#### _narrow

    protected JavaType _narrow(Class<?> subclass)

Overrides:
  `_narrow` in class `SimpleType`

#### getReferencedType

    public JavaType getReferencedType()

Overrides:
  `getReferencedType` in class `JavaType`

#### isReferenceType

    public boolean isReferenceType()

Overrides:
  `isReferenceType` in class `ResolvedType`

#### containedTypeCount

    public int containedTypeCount()

Overrides:
  `containedTypeCount` in class `SimpleType`

#### containedType

    public JavaType containedType(int index)

Overrides:
  `containedType` in class `SimpleType`

#### containedTypeName

    public String containedTypeName(int index)

Overrides:
  `containedTypeName` in class `SimpleType`

#### getParameterSource

    public Class<?> getParameterSource()

Overrides:
  `getParameterSource` in class `SimpleType`

#### getErasedSignature

    public StringBuilder getErasedSignature(StringBuilder sb)

Description copied from class: `JavaType`
Method for accessing signature without generic type information, in form compatible with all versions of JVM, and specifically used for type descriptions when generating byte code.

Overrides:
  `getErasedSignature` in class `SimpleType`
Parameters:
  `sb` - StringBuilder to append signature to
Returns:
  StringBuilder that was passed in; returned to allow call chaining

#### getGenericSignature

    public StringBuilder getGenericSignature(StringBuilder sb)

Overrides:
  `getGenericSignature` in class `SimpleType`
Parameters:
  `sb` - StringBuilder to append signature to
Returns:
  StringBuilder that was passed in; returned to allow call chaining

#### toString

    public String toString()

Overrides:
  `toString` in class `SimpleType`

#### equals

    public boolean equals(Object o)

Overrides:
  `equals` in class `SimpleType`