com.fasterxml.jackson.databind.type

## Class ArrayType

- java.lang.Object
- - com.fasterxml.jackson.core.type.ResolvedType
  - - com.fasterxml.jackson.databind.JavaType
    - - com.fasterxml.jackson.databind.type.TypeBase
      - - com.fasterxml.jackson.databind.type.ArrayType

- All Implemented Interfaces:
    JsonSerializable, Serializable, Type

      public final class ArrayType
      extends TypeBase

  Array types represent Java arrays, both primitive and object valued. Further, Object-valued arrays can have element type of any other legal `JavaType`.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected JavaType` | `_componentType` Type of elements in the array.
    `protected Object` | `_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.

    - ### Fields inherited from class com.fasterxml.jackson.databind.JavaType

      `_asStatic, _class, _hash, _typeHandler, _valueHandler`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected JavaType` | `_narrow(Class<?> subclass)` Handling of narrowing conversions for arrays is trickier: for now, it is not even allowed.
    `protected String` | `buildCanonicalName()`
    `static ArrayType` | `construct(JavaType componentType, Object valueHandler, Object typeHandler)`
    `JavaType` | `containedType(int index)`
    `int` | `containedTypeCount()`
    `String` | `containedTypeName(int index)` Not sure what symbolic name is used internally, if any; let's follow naming of Collection types here.
    `boolean` | `equals(Object o)`
    `JavaType` | `getContentType()`
    `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)`
    `boolean` | `hasGenericTypes()`
    `boolean` | `isAbstract()` For some odd reason, modifiers for array classes would claim they are abstract types.
    `boolean` | `isArrayType()`
    `boolean` | `isConcrete()` For some odd reason, modifiers for array classes would claim they are abstract types.
    `boolean` | `isContainerType()`
    `JavaType` | `narrowContentsBy(Class<?> contentClass)` For array types, both main type and content type can be modified; but ultimately they are interchangeable.
    `String` | `toString()`
    `JavaType` | `widenContentsBy(Class<?> contentClass)`
    `ArrayType` | `withContentTypeHandler(Object h)` "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.
    `ArrayType` | `withContentValueHandler(Object h)` "Copy method" that will construct a new instance that is identical to this instance, except that it will have specified content value handler assigned.
    `ArrayType` | `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.
    `ArrayType` | `withTypeHandler(Object h)` "Copy method" that will construct a new instance that is identical to this instance, except that it will have specified type handler assigned.
    `ArrayType` | `withValueHandler(Object h)` "Copy method" that will construct a new instance that is identical to this instance, except that it will have specified value handler assigned.

    - ### Methods inherited from class com.fasterxml.jackson.databind.type.TypeBase

      `_classSignature, getTypeHandler, getValueHandler, serialize, serializeWithType, toCanonical`

    - ### Methods inherited from class com.fasterxml.jackson.databind.JavaType

      `_assertSubclass, _widen, forcedNarrowBy, getErasedSignature, getGenericSignature, getKeyType, getRawClass, hashCode, hasRawClass, isCollectionLikeType, isEnumType, isFinal, isInterface, isMapLikeType, isPrimitive, isThrowable, narrowBy, useStaticType, widenBy`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### _componentType

          protected final JavaType _componentType

      Type of elements in the array.

    - #### _emptyArray

          protected final Object _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 Detail

    - #### construct

          public static ArrayType construct(JavaType componentType,
                            Object valueHandler,
                            Object typeHandler)

    - #### withTypeHandler

          public ArrayType withTypeHandler(Object h)

      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 class `JavaType`
      Returns:
        Newly created type instance

    - #### withContentTypeHandler

          public ArrayType withContentTypeHandler(Object h)

      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 class `JavaType`
      Returns:
        Newly created type instance

    - #### withValueHandler

          public ArrayType withValueHandler(Object h)

      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 value handler assigned.
      Specified by:
        `withValueHandler` in class `JavaType`
      Returns:
        Newly created type instance

    - #### withContentValueHandler

          public ArrayType withContentValueHandler(Object h)

      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 content value handler assigned.
      Specified by:
        `withContentValueHandler` in class `JavaType`
      Returns:
        Newly created type instance

    - #### withStaticTyping

          public ArrayType withStaticTyping()

      Description copied from class: `JavaType`
      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. The main use case is to allow forcing of specific root value serialization type, and specifically in resolving serializers for contained types (element types for arrays, Collections and Maps).
      Specified by:
        `withStaticTyping` in class `JavaType`

    - #### buildCanonicalName

          protected String buildCanonicalName()

      Specified by:
        `buildCanonicalName` in class `TypeBase`

    - #### _narrow

          protected JavaType _narrow(Class<?> subclass)

      Handling of narrowing conversions for arrays is trickier: for now, it is not even allowed.
      Specified by:
        `_narrow` in class `JavaType`

    - #### narrowContentsBy

          public JavaType narrowContentsBy(Class<?> contentClass)

      For array types, both main type and content type can be modified; but ultimately they are interchangeable.
      Specified by:
        `narrowContentsBy` in class `JavaType`

    - #### widenContentsBy

          public JavaType widenContentsBy(Class<?> contentClass)

      Specified by:
        `widenContentsBy` in class `JavaType`

    - #### isArrayType

          public boolean isArrayType()

      Overrides:
        `isArrayType` in class `JavaType`

    - #### 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 class `JavaType`

    - #### 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 class `JavaType`

    - #### hasGenericTypes

          public boolean hasGenericTypes()

      Overrides:
        `hasGenericTypes` in class `JavaType`

    - #### containedTypeName

          public String containedTypeName(int index)

      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 class `JavaType`

    - #### isContainerType

          public boolean isContainerType()

      Specified by:
        `isContainerType` in class `JavaType`
      Returns:
        True if type represented is a container type; this includes array, Map and Collection types.

    - #### getContentType

          public JavaType getContentType()

      Overrides:
        `getContentType` in class `JavaType`

    - #### containedTypeCount

          public int containedTypeCount()

      Overrides:
        `containedTypeCount` in class `JavaType`

    - #### containedType

          public JavaType containedType(int index)

      Overrides:
        `containedType` in class `JavaType`

    - #### getGenericSignature

          public StringBuilder getGenericSignature(StringBuilder sb)

      Specified by:
        `getGenericSignature` in class `TypeBase`
      Parameters:
        `sb` - StringBuilder to append signature to
      Returns:
        StringBuilder that was passed in; returned to allow call chaining

    - #### getErasedSignature

          public StringBuilder getErasedSignature(StringBuilder sb)

      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 class `TypeBase`
      Parameters:
        `sb` - StringBuilder to append signature to
      Returns:
        StringBuilder that was passed in; returned to allow call chaining

    - #### toString

          public String toString()

      Specified by:
        `toString` in class `JavaType`

    - #### equals

          public boolean equals(Object o)

      Specified by:
        `equals` in class `JavaType`

Copyright © 2014 FasterXML. All Rights Reserved.