Package org.codehaus.jackson.map.type
Class ArrayType
java.lang.Object
org.codehaus.jackson.type.JavaType
org.codehaus.jackson.map.type.TypeBase
org.codehaus.jackson.map.type.ArrayType
- All Implemented Interfaces:
JsonSerializable
,JsonSerializableWithType
Array types represent Java arrays, both primitive and object valued.
Further, Object-valued arrays can have element type of any other
legal
JavaType
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final JavaType
Type of elements in the array.protected final Object
We will also keep track of shareable instance of empty array, since it usually needs to be constructed any way; and because it is essentially immutable and thus can be shared.Fields inherited from class org.codehaus.jackson.type.JavaType
_class, _hashCode, _typeHandler, _valueHandler
-
Method Summary
Modifier and TypeMethodDescriptionprotected JavaType
Handling of narrowing conversions for arrays is trickier: for now, it is not even allowed.protected String
static ArrayType
Deprecated.Since 1.9, if you must directly instantiate, call method that takes handlersstatic ArrayType
containedType
(int index) Method for accessing definitions of contained ("child") types.int
Method for checking how many contained types this type has.containedTypeName
(int index) Not sure what symbolic name is used internally, if any; let's follow naming of Collection types here.boolean
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)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.boolean
Method that can be used to find out if the type directly declares generic parameters (for its direct super-class and/or super-interfaces).boolean
For some odd reason, modifiers for array classes would claim they are abstract types.boolean
boolean
For some odd reason, modifiers for array classes would claim they are abstract types.boolean
narrowContentsBy
(Class<?> contentClass) For array types, both main type and content type can be modified; but ultimately they are interchangeable.toString()
widenContentsBy
(Class<?> contentClass) "Copy method" that will construct a new instance that is identical to this instance, except that its content type will have specified type handler assigned."Copy method" that will construct a new instance that is identical to this instance, except that it will have specified type handler assigned.Methods inherited from class org.codehaus.jackson.map.type.TypeBase
_classSignature, getTypeHandler, getValueHandler, serialize, serializeWithType, toCanonical
Methods inherited from class org.codehaus.jackson.type.JavaType
_assertSubclass, _widen, forcedNarrowBy, getErasedSignature, getGenericSignature, getKeyType, getRawClass, hashCode, hasRawClass, isCollectionLikeType, isEnumType, isFinal, isInterface, isMapLikeType, isPrimitive, isThrowable, isTypeOrSubTypeOf, narrowBy, setValueHandler, widenBy
-
Field Details
-
_componentType
Type of elements in the array. -
_emptyArray
We will also keep track of shareable instance of empty array, since it usually needs to be constructed any way; and because it is essentially immutable and thus can be shared.
-
-
Method Details
-
construct
Deprecated.Since 1.9, if you must directly instantiate, call method that takes handlers -
construct
-
withTypeHandler
Description copied from class:JavaType
"Copy method" that will construct a new instance that is identical to this instance, except that it will have specified type handler assigned.- Specified by:
withTypeHandler
in classJavaType
- Returns:
- Newly created type instance
-
withContentTypeHandler
Description copied from class:JavaType
"Copy method" that will construct a new instance that is identical to this instance, except that its content type will have specified type handler assigned.- Specified by:
withContentTypeHandler
in classJavaType
- Returns:
- Newly created type instance
-
withValueHandler
- Overrides:
withValueHandler
in classJavaType
-
withContentValueHandler
- Overrides:
withContentValueHandler
in classJavaType
-
buildCanonicalName
- Specified by:
buildCanonicalName
in classTypeBase
-
_narrow
Handling of narrowing conversions for arrays is trickier: for now, it is not even allowed. -
narrowContentsBy
For array types, both main type and content type can be modified; but ultimately they are interchangeable.- Specified by:
narrowContentsBy
in classJavaType
-
widenContentsBy
- Specified by:
widenContentsBy
in classJavaType
-
isArrayType
public boolean isArrayType()- Overrides:
isArrayType
in classJavaType
-
isAbstract
public boolean isAbstract()For some odd reason, modifiers for array classes would claim they are abstract types. Not so, at least for our purposes.- Overrides:
isAbstract
in classJavaType
-
isConcrete
public boolean isConcrete()For some odd reason, modifiers for array classes would claim they are abstract types. Not so, at least for our purposes.- Overrides:
isConcrete
in classJavaType
-
hasGenericTypes
public boolean hasGenericTypes()Description copied from class:JavaType
Method that can be used to find out if the type directly declares generic parameters (for its direct super-class and/or super-interfaces).- Overrides:
hasGenericTypes
in classJavaType
-
containedTypeName
Not sure what symbolic name is used internally, if any; let's follow naming of Collection types here. Should not really matter since array types have no super types.- Overrides:
containedTypeName
in classJavaType
- Parameters:
index
- Index of contained type to return- Returns:
- Contained type at index, or null if no such type exists (no exception thrown)
-
isContainerType
public boolean isContainerType()- Specified by:
isContainerType
in classJavaType
- Returns:
- True if type represented is a container type; this includes array, Map and Collection types.
-
getContentType
Description copied from class:JavaType
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)- Overrides:
getContentType
in classJavaType
-
containedTypeCount
public int containedTypeCount()Description copied from class:JavaType
Method for checking how many contained types this type has. Contained types are usually generic types, so that generic Maps have 2 contained types.- Overrides:
containedTypeCount
in classJavaType
-
containedType
Description copied from class:JavaType
Method for accessing definitions of contained ("child") types.- Overrides:
containedType
in classJavaType
- Parameters:
index
- Index of contained type to return- Returns:
- Contained type at index, or null if no such type exists (no exception thrown)
-
getGenericSignature
- Specified by:
getGenericSignature
in classTypeBase
- Parameters:
sb
- StringBuilder to append signature to- Returns:
- StringBuilder that was passed in; returned to allow call chaining
-
getErasedSignature
Description copied from class:JavaType
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.- Specified by:
getErasedSignature
in classTypeBase
- Parameters:
sb
- StringBuilder to append signature to- Returns:
- StringBuilder that was passed in; returned to allow call chaining
-
toString
-
equals
-