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.
|
protected JavaType |
_superClass |
protected JavaType[] |
_superInterfaces |
_asStatic, _class, _hash, _typeHandler, _valueHandler
Modifier | Constructor and Description |
---|---|
protected |
TypeBase(Class<?> raw,
TypeBindings bindings,
JavaType superClass,
JavaType[] superInts,
int hash,
Object valueHandler,
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(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 StringBuilder |
_classSignature(Class<?> cls,
StringBuilder sb,
boolean trailingSemicolon) |
protected String |
buildCanonicalName() |
JavaType |
containedType(int index)
Method for accessing definitions of contained ("child")
types.
|
int |
containedTypeCount()
Method for checking how many contained types this type
has.
|
String |
containedTypeName(int index)
Deprecated.
|
JavaType |
findSuperType(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(Class<?> expType)
Method that may be used to find paramaterization this type has for
given type-erased generic target type.
|
TypeBindings |
getBindings() |
abstract 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.
|
abstract StringBuilder |
getGenericSignature(StringBuilder sb) |
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.
|
void |
serialize(JsonGenerator gen,
SerializerProvider provider)
Serialization method called when no additional type information is
to be included in serialization.
|
void |
serializeWithType(JsonGenerator g,
SerializerProvider provider,
TypeSerializer typeSer)
Serialization method called when additional type information is
expected to be included in serialization, for deserialization to use.
|
String |
toCanonical()
Method that can be used to serialize type into form from which
it can be fully deserialized from at a later point (using
TypeFactory from mapper package). |
_narrow, containedTypeOrUnknown, equals, forcedNarrowBy, getContentType, getContentTypeHandler, getContentValueHandler, getErasedSignature, getGenericSignature, getKeyType, getParameterSource, getRawClass, getReferencedType, getTypeHandler, getValueHandler, hasContentType, hasGenericTypes, hasHandlers, hashCode, hasRawClass, hasValueHandler, isAbstract, isArrayType, isCollectionLikeType, isConcrete, isContainerType, isEnumType, isFinal, isInterface, isJavaLangObject, isMapLikeType, isPrimitive, isThrowable, isTypeOrSubTypeOf, isTypeOrSuperTypeOf, refine, toString, useStaticType, withContentType, withContentTypeHandler, withContentValueHandler, withHandlersFrom, withStaticTyping, withTypeHandler, withValueHandler
isReferenceType
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getTypeName
protected final JavaType _superClass
protected final JavaType[] _superInterfaces
protected final TypeBindings _bindings
protected TypeBase(Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInts, int hash, Object valueHandler, Object typeHandler, boolean asStatic)
protected TypeBase(TypeBase base)
public String toCanonical()
ResolvedType
TypeFactory
from mapper package).
For simple types this is same as calling
Class.getName()
, but for structured types it may additionally
contain type information about contents.toCanonical
in class ResolvedType
protected String buildCanonicalName()
public abstract StringBuilder getGenericSignature(StringBuilder sb)
getGenericSignature
in class JavaType
sb
- StringBuilder to append signature topublic abstract StringBuilder getErasedSignature(StringBuilder sb)
JavaType
getErasedSignature
in class JavaType
sb
- StringBuilder to append signature topublic TypeBindings getBindings()
getBindings
in class JavaType
public int containedTypeCount()
ResolvedType
containedTypeCount
in class JavaType
public JavaType containedType(int index)
ResolvedType
containedType
in class JavaType
index
- Index of contained type to return@Deprecated public String containedTypeName(int index)
ResolvedType
containedTypeName
in class JavaType
index
- Index of contained type to returnpublic JavaType getSuperClass()
JavaType
getSuperClass
in class JavaType
public List<JavaType> getInterfaces()
JavaType
getInterfaces
in class JavaType
public final JavaType findSuperType(Class<?> rawTarget)
JavaType
findSuperType
in class JavaType
public JavaType[] findTypeParameters(Class<?> expType)
JavaType
findTypeParameters
in class JavaType
public void serializeWithType(JsonGenerator g, SerializerProvider provider, TypeSerializer typeSer) throws IOException
JsonSerializable
Usually implementation consists of a call to TypeSerializer.writeTypePrefix(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.WritableTypeId)
followed by serialization of contents,
followed by a call to TypeSerializer.writeTypeSuffix(com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.core.type.WritableTypeId)
).
Details of the type id argument to pass 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
IOException
public void serialize(JsonGenerator gen, SerializerProvider provider) throws IOException, JsonProcessingException
JsonSerializable
serialize
in interface JsonSerializable
IOException
JsonProcessingException
protected static StringBuilder _classSignature(Class<?> cls, StringBuilder sb, boolean trailingSemicolon)
trailingSemicolon
- Whether to add trailing semicolon for non-primitive
(reference) types or notprotected static JavaType _bogusSuperClass(Class<?> cls)
Copyright © 2018 JBoss by Red Hat. All rights reserved.