public class ReferenceType extends SimpleType
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()
.JsonSerializable.Base
Modifier and Type | Field and Description |
---|---|
protected JavaType |
_anchorType
Essential type used for type ids, for example if type id is needed for
referencing type with polymorphic handling.
|
protected JavaType |
_referencedType |
_bindings, _superClass, _superInterfaces
_asStatic, _class, _hash, _typeHandler, _valueHandler
Modifier | Constructor 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(com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.JavaType) ,
the usual way for ReferenceType s to come into existence. |
Modifier and Type | Method and Description |
---|---|
protected JavaType |
_narrow(Class<?> subclass)
Deprecated.
|
protected String |
buildCanonicalName() |
static ReferenceType |
construct(Class<?> cls,
JavaType refType)
Deprecated.
|
static ReferenceType |
construct(Class<?> cls,
TypeBindings bindings,
JavaType superClass,
JavaType[] superInts,
JavaType refType) |
boolean |
equals(Object o) |
JavaType |
getAnchorType() |
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)
|
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) |
JavaType |
getReferencedType()
Method for accessing type of value that instances of this
type references, if any.
|
boolean |
hasContentType()
Accessor that allows determining whether
JavaType.getContentType() should
return a non-null value (that is, there is a "content type") or not. |
boolean |
isAnchorType()
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 |
boolean |
isReferenceType()
Whether this type is a referential type, meaning that values are
basically pointers to "real" values (or null) and not regular
values themselves.
|
JavaType |
refine(Class<?> rawType,
TypeBindings bindings,
JavaType superClass,
JavaType[] superInterfaces)
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.
|
String |
toString() |
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 |
JavaType |
withContentType(JavaType contentType)
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.
|
ReferenceType |
withContentTypeHandler(Object h)
Mutant factory method that 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.
|
ReferenceType |
withContentValueHandler(Object h)
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.
|
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)
Mutant factory method that will construct a new instance that is identical to
this instance, except that it will have specified value handler assigned.
|
construct, constructUnsafe, isContainerType
_bogusSuperClass, _classSignature, containedType, containedTypeCount, containedTypeName, findSuperType, findTypeParameters, getBindings, getInterfaces, getSuperClass, serialize, serializeWithType, toCanonical
containedTypeOrUnknown, forcedNarrowBy, getContentTypeHandler, getContentValueHandler, getErasedSignature, getGenericSignature, getKeyType, getParameterSource, getRawClass, getTypeHandler, getValueHandler, hasGenericTypes, hasHandlers, hashCode, hasRawClass, hasValueHandler, isAbstract, isArrayType, isCollectionLikeType, isConcrete, isEnumType, isFinal, isInterface, isJavaLangObject, isMapLikeType, isPrimitive, isThrowable, isTypeOrSubTypeOf, isTypeOrSuperTypeOf, useStaticType, withHandlersFrom
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getTypeName
protected final JavaType _referencedType
protected final JavaType _anchorType
SimpleType
is upgraded into reference type, but NOT changed
if being sub-classed.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)
upgradeFrom(com.fasterxml.jackson.databind.JavaType, com.fasterxml.jackson.databind.JavaType)
,
the usual way for ReferenceType
s to come into existence.
Sets up what is considered the "base" reference typepublic static ReferenceType upgradeFrom(JavaType baseType, JavaType refdType)
TypeModifier
baseType
- Resolved non-reference type (usually SimpleType
) that is being upgradedrefdType
- Referenced type; usually the first and only type parameter, but not necessarilypublic static ReferenceType construct(Class<?> cls, TypeBindings bindings, JavaType superClass, JavaType[] superInts, JavaType refType)
@Deprecated public static ReferenceType construct(Class<?> cls, JavaType refType)
public JavaType withContentType(JavaType contentType)
JavaType
this
is returned.
If type does not have a content type (which is the case with
SimpleType
), IllegalArgumentException
will be thrown.withContentType
in class SimpleType
public ReferenceType withTypeHandler(Object h)
JavaType
withTypeHandler
in class SimpleType
public ReferenceType withContentTypeHandler(Object h)
JavaType
withContentTypeHandler
in class SimpleType
public ReferenceType withValueHandler(Object h)
JavaType
withValueHandler
in class SimpleType
public ReferenceType withContentValueHandler(Object h)
JavaType
withContentValueHandler
in class SimpleType
public ReferenceType withStaticTyping()
JavaType
withStaticTyping
in class SimpleType
public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces)
JavaType
refine
in class SimpleType
protected String buildCanonicalName()
buildCanonicalName
in class SimpleType
@Deprecated protected JavaType _narrow(Class<?> subclass)
_narrow
in class SimpleType
public JavaType getContentType()
ResolvedType
getContentType
in class JavaType
public JavaType getReferencedType()
ResolvedType
getReferencedType
in class JavaType
public boolean hasContentType()
JavaType
JavaType.getContentType()
should
return a non-null value (that is, there is a "content type") or not.
True if JavaType.isContainerType()
or ResolvedType.isReferenceType()
return true.hasContentType
in class SimpleType
public boolean isReferenceType()
ResolvedType
AtomicReference
, and various
Optional
types (in JDK8, Guava).isReferenceType
in class ResolvedType
public StringBuilder getErasedSignature(StringBuilder sb)
JavaType
getErasedSignature
in class SimpleType
sb
- StringBuilder to append signature topublic StringBuilder getGenericSignature(StringBuilder sb)
getGenericSignature
in class SimpleType
sb
- StringBuilder to append signature topublic JavaType getAnchorType()
public boolean isAnchorType()
ReferenceType
public String toString()
toString
in class SimpleType
public boolean equals(Object o)
equals
in class SimpleType
Copyright © 2019 JBoss by Red Hat. All rights reserved.