Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.type

public Class ReferenceType

extends SimpleType
Class Inheritance
Imports
java.util.Objects, com.fasterxml.jackson.databind.JavaType

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 getContentType().
Since
2.6

Field Summary

Modifier and TypeField and Description
protected final JavaType
_anchorType

Deprecated Since 2.16
Essential type used for type ids, for example if type id is needed for referencing type with polymorphic handling.
protected final JavaType
private static final long

Constructor Summary

AccessConstructor and Description
protected
ReferenceType(Class<?> cls, TypeBindings bindings, JavaType superClass, JavaType[] superInts, JavaType refType, JavaType anchorType, Object valueHandler, Object typeHandler, boolean asStatic)

protected
ReferenceType(TypeBase base, JavaType refType)

Constructor used when upgrading into this type (via upgradeFrom, the usual way for ReferenceTypes to come into existence.

Method Summary

Modifier and TypeMethod and Description
protected String
public static ReferenceType
construct(Class<?> cls, TypeBindings bindings, JavaType superClass, JavaType[] superInts, JavaType refType)

public static ReferenceType
construct(Class<?> cls, JavaType refType)
Deprecated

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides com.fasterxml.jackson.databind.type.SimpleType.equals.

Indicates whether some other object is "equal to" this one.

public JavaType
getAnchorType()
Deprecated Since 2.16

public JavaType
getContentType()

Overrides com.fasterxml.jackson.databind.JavaType.getContentType.

Method for accessing content type of this type, if type has such a thing: simple types do not, structured types do (like arrays, Collections and Maps)

public StringBuilder
getErasedSignature(StringBuilder
StringBuilder to append signature to
sb
)

Overrides com.fasterxml.jackson.databind.type.SimpleType.getErasedSignature.

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.

public StringBuilder
public JavaType
getReferencedType()

Overrides com.fasterxml.jackson.databind.JavaType.getReferencedType.

Method for accessing type of value that instances of this type references, if any.

public boolean
hasContentType()

Overrides com.fasterxml.jackson.databind.type.SimpleType.hasContentType.

Accessor that allows determining whether getContentType() should return a non-null value (that is, there is a "content type") or not.

public boolean
isAnchorType()
Deprecated Since 2.16

Convenience accessor that allows checking whether this is the anchor type itself; if not, it must be one of supertypes that is also a ReferenceType

public boolean
isReferenceType()

Overrides com.fasterxml.jackson.core.type.ResolvedType.isReferenceType.

Whether this type is a referential type, meaning that values are basically pointers to "real" values (or null) and not regular values themselves.

public JavaType
refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces)

Overrides com.fasterxml.jackson.databind.type.SimpleType.refine.

Mutant factory method that will try to create and return a sub-type instance for known parameterized types; for other types will return `null` to indicate that no just refinement makes necessary sense, without trying to detect special status through implemented interfaces.

public String
toString()

Overrides com.fasterxml.jackson.databind.type.SimpleType.toString.

Returns a string representation of the object.

public static ReferenceType
upgradeFrom(JavaType
Resolved non-reference type (usually SimpleType) that is being upgraded
baseType
,
JavaType
Referenced type; usually the first and only type parameter, but not necessarily
refdType
)

Factory method that can be used to "upgrade" a basic type into collection-like one; usually done via TypeModifier

public JavaType
withContentType(JavaType contentType)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withContentType.

Mutant factory method that may be called on structured types that have a so-called content type (element of arrays, value type of Maps, referenced type of referential types), and will construct a new instance that is identical to this instance, except that it has specified content type, instead of current one.

public ReferenceType
withContentTypeHandler(Object
Handler to pass to new instance created
h
)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withContentTypeHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind.

public ReferenceType
withContentValueHandler(Object
Handler to pass to new instance created
h
)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withContentValueHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind.

public ReferenceType
withStaticTyping()

Overrides com.fasterxml.jackson.databind.type.SimpleType.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.

public ReferenceType
withTypeHandler(Object
Handler to pass to new instance created
h
)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withTypeHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind.

public ReferenceType
withValueHandler(Object
Handler to pass to new instance created
h
)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withValueHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind.

Inherited from com.fasterxml.jackson.databind.type.SimpleType:
constructconstructUnsafeisContainerType

Field Detail

_anchorTypeback to summary
protected final JavaType _anchorType

Deprecated

Since 2.16

Essential type used for type ids, for example if type id is needed for referencing type with polymorphic handling. Typically initialized when a SimpleType is upgraded into reference type, but NOT changed if being sub-classed.

Annotations
@Deprecated
Since
2.8
_referencedTypeback to summary
protected final JavaType _referencedType
serialVersionUIDback to summary
private static final long serialVersionUID

Hides com.fasterxml.jackson.databind.type.SimpleType.serialVersionUID.

Constructor Detail

ReferenceTypeback to summary
protected ReferenceType(Class<?> cls, TypeBindings bindings, JavaType superClass, JavaType[] superInts, JavaType refType, JavaType anchorType, Object valueHandler, Object typeHandler, boolean asStatic)
ReferenceTypeback to summary
protected ReferenceType(TypeBase base, JavaType refType)

Constructor used when upgrading into this type (via upgradeFrom, the usual way for ReferenceTypes to come into existence. Sets up what is considered the "base" reference type

Since
2.7

Method Detail

buildCanonicalNameback to summary
protected String buildCanonicalName()

Overrides com.fasterxml.jackson.databind.type.SimpleType.buildCanonicalName.

Annotations
@Override
constructback to summary
public static ReferenceType construct(Class<?> cls, TypeBindings bindings, JavaType superClass, JavaType[] superInts, JavaType refType)
Since
2.7
constructback to summary
public static ReferenceType construct(Class<?> cls, JavaType refType)

Deprecated

Annotations
@Deprecated
equalsback to summary
public boolean equals(Object o)

Overrides com.fasterxml.jackson.databind.type.SimpleType.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getAnchorTypeback to summary
public JavaType getAnchorType()

Deprecated

Since 2.16

Annotations
@Deprecated
getContentTypeback to summary
public JavaType getContentType()

Overrides com.fasterxml.jackson.databind.JavaType.getContentType.

Doc from com.fasterxml.jackson.core.type.ResolvedType.getContentType.

Method for accessing content type of this type, if type has such a thing: simple types do not, structured types do (like arrays, Collections and Maps)

Returns:JavaType

Content type of this type, if any; null if none

Annotations
@Override
getErasedSignatureback to summary
public StringBuilder getErasedSignature(StringBuilder sb)

Overrides com.fasterxml.jackson.databind.type.SimpleType.getErasedSignature.

Doc from com.fasterxml.jackson.databind.JavaType.getErasedSignature.

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.

Parameters
sb:StringBuilder

StringBuilder to append signature to

Returns:StringBuilder

StringBuilder that was passed in; returned to allow call chaining

Annotations
@Override
getGenericSignatureback to summary
public StringBuilder getGenericSignature(StringBuilder sb)

Overrides com.fasterxml.jackson.databind.type.SimpleType.getGenericSignature.

Parameters
sb:StringBuilder

Doc from com.fasterxml.jackson.databind.JavaType.getGenericSignature.

StringBuilder to append signature to

Returns:StringBuilder

Doc from com.fasterxml.jackson.databind.JavaType.getGenericSignature.

StringBuilder that was passed in; returned to allow call chaining

Annotations
@Override
getReferencedTypeback to summary
public JavaType getReferencedType()

Overrides com.fasterxml.jackson.databind.JavaType.getReferencedType.

Doc from com.fasterxml.jackson.core.type.ResolvedType.getReferencedType.

Method for accessing type of value that instances of this type references, if any.

Returns:JavaType

Referenced type, if any; null if not.

Annotations
@Override
hasContentTypeback to summary
public boolean hasContentType()

Overrides com.fasterxml.jackson.databind.type.SimpleType.hasContentType.

Doc from com.fasterxml.jackson.databind.JavaType.hasContentType.

Accessor that allows determining whether getContentType() should return a non-null value (that is, there is a "content type") or not. True if isContainerType() or isReferenceType() return true.

Annotations
@Override
isAnchorTypeback to summary
public boolean isAnchorType()

Deprecated

Since 2.16

Convenience accessor that allows checking whether this is the anchor type itself; if not, it must be one of supertypes that is also a ReferenceType

Annotations
@Deprecated
isReferenceTypeback to summary
public boolean isReferenceType()

Overrides com.fasterxml.jackson.core.type.ResolvedType.isReferenceType.

Doc from com.fasterxml.jackson.core.type.ResolvedType.isReferenceType.

Whether this type is a referential type, meaning that values are basically pointers to "real" values (or null) and not regular values themselves. Typical examples include things like java.util.concurrent.atomic.AtomicReference, and various Optional types (in JDK8, Guava).

Returns:boolean

True if this is a "referential" type, false if not

Annotations
@Override
refineback to summary
public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces)

Overrides com.fasterxml.jackson.databind.type.SimpleType.refine.

Doc from com.fasterxml.jackson.databind.JavaType.refine.

Mutant factory method that will try to create and return a sub-type instance for known parameterized types; for other types will return `null` to indicate that no just refinement makes necessary sense, without trying to detect special status through implemented interfaces.

Annotations
@Override
toStringback to summary
public String toString()

Overrides com.fasterxml.jackson.databind.type.SimpleType.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
upgradeFromback to summary
public static ReferenceType upgradeFrom(JavaType baseType, JavaType refdType)

Factory method that can be used to "upgrade" a basic type into collection-like one; usually done via TypeModifier

Parameters
baseType:JavaType

Resolved non-reference type (usually SimpleType) that is being upgraded

refdType:JavaType

Referenced type; usually the first and only type parameter, but not necessarily

Since
2.7
withContentTypeback to summary
public JavaType withContentType(JavaType contentType)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withContentType.

Doc from com.fasterxml.jackson.databind.JavaType.withContentType.

Mutant factory method that may be called on structured types that have a so-called content type (element of arrays, value type of Maps, referenced type of referential types), and will construct a new instance that is identical to this instance, except that it has specified content type, instead of current one. If content type is already set to given type, this is returned. If type does not have a content type (which is the case with SimpleType), IllegalArgumentException will be thrown.

Returns:JavaType

Newly created type instance

Annotations
@Override
withContentTypeHandlerback to summary
public ReferenceType withContentTypeHandler(Object h)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withContentTypeHandler.

Doc from com.fasterxml.jackson.databind.JavaType.withContentTypeHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.

This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified content type (element type for arrays, value type for Maps and so forth) handler assigned.

Parameters
h:Object

Handler to pass to new instance created

Returns:ReferenceType

Newly created type instance with same type information, specified handler

Annotations
@Override
withContentValueHandlerback to summary
public ReferenceType withContentValueHandler(Object h)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withContentValueHandler.

Doc from com.fasterxml.jackson.databind.JavaType.withContentValueHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.

Mutant factory method that will construct a new instance that is identical to this instance, except that it will have specified content value handler assigned.

Parameters
h:Object

Handler to pass to new instance created

Returns:ReferenceType

Newly created type instance with same type information, specified handler

Annotations
@Override
withStaticTypingback to summary
public ReferenceType withStaticTyping()

Overrides com.fasterxml.jackson.databind.type.SimpleType.withStaticTyping.

Doc from com.fasterxml.jackson.databind.JavaType.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. 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).

Annotations
@Override
withTypeHandlerback to summary
public ReferenceType withTypeHandler(Object h)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withTypeHandler.

Doc from com.fasterxml.jackson.databind.JavaType.withTypeHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.

This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified type handler assigned.

Parameters
h:Object

Handler to pass to new instance created

Returns:ReferenceType

Newly created type instance with same type information, specified handler

Annotations
@Override
withValueHandlerback to summary
public ReferenceType withValueHandler(Object h)

Overrides com.fasterxml.jackson.databind.type.SimpleType.withValueHandler.

Doc from com.fasterxml.jackson.databind.JavaType.withValueHandler.

Internal method that should not be used by any code outside of jackson-databind: only used internally by databind. May be removed from Jackson 3.0.

This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified value handler assigned.

Parameters
h:Object

Handler to pass to new instance created

Returns:ReferenceType

Newly created type instance with same type information, specified handler

Annotations
@Override