public class MapLikeType extends TypeBase
Map
, but that do not
have enough introspection functionality to allow for some level of generic
handling. This specifically allows framework to check for configuration and
annotation settings used for Map types, and pass these to custom handlers
that may be more familiar with actual type.JsonSerializable.Base
Modifier and Type | Field and Description |
---|---|
protected JavaType |
_keyType
Type of keys of Map.
|
protected JavaType |
_valueType
Type of values of Map.
|
_bindings, _superClass, _superInterfaces
_asStatic, _class, _hash, _typeHandler, _valueHandler
Modifier | Constructor and Description |
---|---|
protected |
MapLikeType(Class<?> mapType,
TypeBindings bindings,
JavaType superClass,
JavaType[] superInts,
JavaType keyT,
JavaType valueT,
Object valueHandler,
Object typeHandler,
boolean asStatic) |
protected |
MapLikeType(TypeBase base,
JavaType keyT,
JavaType valueT) |
Modifier and Type | Method and Description |
---|---|
protected JavaType |
_narrow(Class<?> subclass)
Deprecated.
|
protected String |
buildCanonicalName() |
static MapLikeType |
construct(Class<?> rawType,
JavaType keyT,
JavaType valueT)
Deprecated.
|
boolean |
equals(Object o) |
JavaType |
getContentType() |
Object |
getContentTypeHandler()
Internal accessor that should not be used by any code outside of
jackson-databind: only used internally by databind.
|
Object |
getContentValueHandler()
Internal accessor that should not be used by any code outside of
jackson-databind: only used internally by databind.
|
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 |
getKeyType() |
boolean |
hasHandlers()
Helper method that checks whether this type, or its (optional) key
or content type has
JavaType.getValueHandler() or JavaType.getTypeHandler() ;
that is, are there any non-standard handlers associated with this
type object. |
boolean |
isContainerType() |
boolean |
isMapLikeType() |
boolean |
isTrueMapType()
Deprecated.
Since 2.12 just use instanceof
|
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 MapLikeType |
upgradeFrom(JavaType baseType,
JavaType keyT,
JavaType valueT)
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.
|
MapLikeType |
withContentTypeHandler(Object h)
Internal method that should not be used by any code outside of
jackson-databind: only used internally by databind.
|
MapLikeType |
withContentValueHandler(Object h)
Internal method that should not be used by any code outside of
jackson-databind: only used internally by databind.
|
JavaType |
withHandlersFrom(JavaType src)
Internal method that should not be used by any code outside of
jackson-databind: only used internally by databind.
|
MapLikeType |
withKeyType(JavaType keyType) |
MapLikeType |
withKeyTypeHandler(Object h) |
MapLikeType |
withKeyValueHandler(Object h) |
MapLikeType |
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.
|
MapLikeType |
withTypeHandler(Object h)
Internal method that should not be used by any code outside of
jackson-databind: only used internally by databind.
|
MapLikeType |
withValueHandler(Object h)
Internal method that should not be used by any code outside of
jackson-databind: only used internally by databind.
|
_bogusSuperClass, _classSignature, _hasNTypeParameters, containedType, containedTypeCount, containedTypeName, findSuperType, findTypeParameters, getBindings, getInterfaces, getSuperClass, serialize, serializeWithType, toCanonical
containedTypeOrUnknown, forcedNarrowBy, getErasedSignature, getGenericSignature, getParameterSource, getRawClass, getReferencedType, getTypeHandler, getValueHandler, hasContentType, hasGenericTypes, hashCode, hasRawClass, hasValueHandler, isAbstract, isArrayType, isCollectionLikeType, isConcrete, isEnumImplType, isEnumType, isFinal, isInterface, isJavaLangObject, isPrimitive, isRecordType, isThrowable, isTypeOrSubTypeOf, isTypeOrSuperTypeOf, useStaticType
isReferenceType
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getTypeName
protected final JavaType _keyType
protected final JavaType _valueType
protected MapLikeType(Class<?> mapType, TypeBindings bindings, JavaType superClass, JavaType[] superInts, JavaType keyT, JavaType valueT, Object valueHandler, Object typeHandler, boolean asStatic)
public static MapLikeType upgradeFrom(JavaType baseType, JavaType keyT, JavaType valueT)
TypeModifier
@Deprecated public static MapLikeType construct(Class<?> rawType, JavaType keyT, JavaType valueT)
@Deprecated protected JavaType _narrow(Class<?> subclass)
public MapLikeType withKeyType(JavaType keyType)
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 JavaType
public MapLikeType withTypeHandler(Object h)
JavaType
This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified type handler assigned.
withTypeHandler
in class JavaType
h
- Handler to pass to new instance createdpublic MapLikeType withContentTypeHandler(Object h)
JavaType
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.
withContentTypeHandler
in class JavaType
h
- Handler to pass to new instance createdpublic MapLikeType withValueHandler(Object h)
JavaType
This mutant factory method will construct a new instance that is identical to this instance, except that it will have specified value handler assigned.
withValueHandler
in class JavaType
h
- Handler to pass to new instance createdpublic MapLikeType withContentValueHandler(Object h)
JavaType
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.
withContentValueHandler
in class JavaType
h
- Handler to pass to new instance createdpublic JavaType withHandlersFrom(JavaType src)
JavaType
Mutant factory method that will try to copy handlers that the specified source type instance had, if any; this must be done recursively where necessary (as content types may be structured).
withHandlersFrom
in class JavaType
public MapLikeType withStaticTyping()
JavaType
withStaticTyping
in class JavaType
public JavaType refine(Class<?> rawType, TypeBindings bindings, JavaType superClass, JavaType[] superInterfaces)
JavaType
protected String buildCanonicalName()
buildCanonicalName
in class TypeBase
public boolean isContainerType()
isContainerType
in class JavaType
public boolean isMapLikeType()
isMapLikeType
in class JavaType
Map
type,
or something similar (meaning it has at least two type parameter;
first one describing key type, second value type)public JavaType getKeyType()
getKeyType
in class JavaType
public JavaType getContentType()
getContentType
in class JavaType
public Object getContentValueHandler()
JavaType
getContentValueHandler
in class JavaType
public Object getContentTypeHandler()
JavaType
getContentTypeHandler
in class JavaType
public boolean hasHandlers()
JavaType
JavaType.getValueHandler()
or JavaType.getTypeHandler()
;
that is, are there any non-standard handlers associated with this
type object.hasHandlers
in class JavaType
public StringBuilder getErasedSignature(StringBuilder sb)
JavaType
getErasedSignature
in class TypeBase
sb
- StringBuilder to append signature topublic StringBuilder getGenericSignature(StringBuilder sb)
getGenericSignature
in class TypeBase
sb
- StringBuilder to append signature topublic MapLikeType withKeyTypeHandler(Object h)
public MapLikeType withKeyValueHandler(Object h)
@Deprecated public boolean isTrueMapType()
Collection
or just something that acts like one.Copyright © 2008–2021 FasterXML. All rights reserved.