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 StringBuilder |
_classSignature(Class<?> cls,
StringBuilder sb,
boolean trailingSemicolon) |
protected String |
buildCanonicalName() |
JavaType |
containedType(int index) |
int |
containedTypeCount() |
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.
|
<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(JsonGenerator gen,
SerializerProvider provider)
Serialization method called when no additional type information is
to be included in serialization.
|
void |
serializeWithType(JsonGenerator gen,
SerializerProvider provider,
TypeSerializer typeSer)
Serialization method called when additional type information is
expected to be included in serialization, for deserialization to use.
|
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
isReferenceType
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()
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 <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 String containedTypeName(int index)
containedTypeName
in class JavaType
public 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 gen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, 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
IOException
JsonProcessingException
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 notCopyright © 2008–2016 FasterXML. All rights reserved.