public abstract class TypeBase extends JavaType implements JsonSerializable
JsonSerializable.Base
Modifier and Type | Field and Description |
---|---|
protected TypeBindings |
_bindings
Bindings in effect for this type instance; possibly empty.
|
(package private) java.lang.String |
_canonicalName
Lazily initialized external representation of the type
|
protected JavaType |
_superClass |
protected JavaType[] |
_superInterfaces |
private static TypeBindings |
NO_BINDINGS |
private static JavaType[] |
NO_TYPES |
private static long |
serialVersionUID |
_asStatic, _class, _hash, _typeHandler, _valueHandler
Modifier | Constructor and Description |
---|---|
protected |
TypeBase(java.lang.Class<?> raw,
TypeBindings bindings,
JavaType superClass,
JavaType[] superInts,
int hash,
java.lang.Object valueHandler,
java.lang.Object typeHandler,
boolean asStatic)
Main constructor to use by extending classes.
|
protected |
TypeBase(TypeBase base)
Copy-constructor used when refining/upgrading type instances.
|
Modifier and Type | Method and Description |
---|---|
protected static JavaType |
_bogusSuperClass(java.lang.Class<?> cls)
Internal helper method used to figure out nominal super-class for
deprecated factory methods / constructors, where we are not given
properly resolved supertype hierarchy.
|
protected static java.lang.StringBuilder |
_classSignature(java.lang.Class<?> cls,
java.lang.StringBuilder sb,
boolean trailingSemicolon) |
protected java.lang.String |
buildCanonicalName() |
JavaType |
containedType(int index) |
int |
containedTypeCount() |
java.lang.String |
containedTypeName(int index)
Deprecated.
|
JavaType |
findSuperType(java.lang.Class<?> rawTarget)
Method that may be called to find representation of given type
within type hierarchy of this type: either this type (if this
type has given erased type), one of its supertypes that has the
erased types, or null if target is neither this type or any of its
supertypes.
|
JavaType[] |
findTypeParameters(java.lang.Class<?> expType)
Method that may be used to find paramaterization this type has for
given type-erased generic target type.
|
TypeBindings |
getBindings() |
abstract java.lang.StringBuilder |
getErasedSignature(java.lang.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.
|
abstract java.lang.StringBuilder |
getGenericSignature(java.lang.StringBuilder sb) |
java.util.List<JavaType> |
getInterfaces()
Accessor for finding fully resolved interfaces this type implements,
if any; empty array if none.
|
JavaType |
getSuperClass()
Accessor for finding fully resolved parent class of this type,
if it has one; null if not.
|
<T> T |
getTypeHandler()
Method for accessing type handler associated with this type, if any
|
<T> T |
getValueHandler()
Method for accessing value handler associated with this type, if any
|
void |
serialize(com.fasterxml.jackson.core.JsonGenerator gen,
SerializerProvider provider)
Serialization method called when no additional type information is
to be included in serialization.
|
void |
serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen,
SerializerProvider provider,
TypeSerializer typeSer)
Serialization method called when additional type information is
expected to be included in serialization, for deserialization to use.
|
java.lang.String |
toCanonical() |
_narrow, containedTypeOrUnknown, equals, forcedNarrowBy, getContentType, getContentTypeHandler, getContentValueHandler, getErasedSignature, getGenericSignature, getKeyType, getParameterSource, getRawClass, getReferencedType, hasGenericTypes, hashCode, hasRawClass, hasValueHandler, isAbstract, isArrayType, isCollectionLikeType, isConcrete, isContainerType, isEnumType, isFinal, isInterface, isJavaLangObject, isMapLikeType, isPrimitive, isThrowable, isTypeOrSubTypeOf, refine, toString, useStaticType, withContentType, withContentTypeHandler, withContentValueHandler, withStaticTyping, withTypeHandler, withValueHandler
private static final long serialVersionUID
private static final TypeBindings NO_BINDINGS
private static final JavaType[] NO_TYPES
protected final JavaType _superClass
protected final JavaType[] _superInterfaces
protected final TypeBindings _bindings
transient volatile java.lang.String _canonicalName
protected TypeBase(java.lang.Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInts, int hash, java.lang.Object valueHandler, java.lang.Object typeHandler, boolean asStatic)
protected TypeBase(TypeBase base)
public java.lang.String toCanonical()
toCanonical
in class com.fasterxml.jackson.core.type.ResolvedType
protected java.lang.String buildCanonicalName()
public abstract java.lang.StringBuilder getGenericSignature(java.lang.StringBuilder sb)
getGenericSignature
in class JavaType
sb
- StringBuilder to append signature topublic abstract java.lang.StringBuilder getErasedSignature(java.lang.StringBuilder sb)
JavaType
getErasedSignature
in class JavaType
sb
- StringBuilder to append signature topublic <T> T getValueHandler()
JavaType
getValueHandler
in class JavaType
public <T> T getTypeHandler()
JavaType
getTypeHandler
in class JavaType
public TypeBindings getBindings()
getBindings
in class JavaType
public int containedTypeCount()
containedTypeCount
in class JavaType
public JavaType containedType(int index)
containedType
in class JavaType
@Deprecated public java.lang.String containedTypeName(int index)
containedTypeName
in class JavaType
public JavaType getSuperClass()
JavaType
getSuperClass
in class JavaType
public java.util.List<JavaType> getInterfaces()
JavaType
getInterfaces
in class JavaType
public final JavaType findSuperType(java.lang.Class<?> rawTarget)
JavaType
findSuperType
in class JavaType
public JavaType[] findTypeParameters(java.lang.Class<?> expType)
JavaType
findTypeParameters
in class JavaType
public void serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSer) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
JsonSerializable
Usually implementation consists of a call to one of methods
in TypeSerializer
(such as TypeSerializer.writeTypePrefixForObject(Object, JsonGenerator)
)
followed by serialization of contents,
followed by another call to TypeSerializer
(such as TypeSerializer.writeTypeSuffixForObject(Object, JsonGenerator)
).
Exact methods to call in TypeSerializer
depend on shape of JSON Object used
(Array, Object or scalar like String/Number/Boolean).
Note that some types (most notably, "natural" types: String, Integer, Double and Boolean) never include type information.
serializeWithType
in interface JsonSerializable
java.io.IOException
com.fasterxml.jackson.core.JsonProcessingException
public void serialize(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider provider) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException
JsonSerializable
serialize
in interface JsonSerializable
java.io.IOException
com.fasterxml.jackson.core.JsonProcessingException
protected static java.lang.StringBuilder _classSignature(java.lang.Class<?> cls, java.lang.StringBuilder sb, boolean trailingSemicolon)
trailingSemicolon
- Whether to add trailing semicolon for non-primitive
(reference) types or notprotected static JavaType _bogusSuperClass(java.lang.Class<?> cls)