TypeBase
Date: 2016-12-04

com.fasterxml.jackson.databind.type

## Class TypeBase

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

- All Implemented Interfaces:
    JsonSerializable, java.io.Serializable, java.lang.reflect.Type
  Direct Known Subclasses:
    ArrayType, CollectionLikeType, MapLikeType, ResolvedRecursiveType, SimpleType

      public abstract class TypeBase
      extends JavaType
      implements JsonSerializable

  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.JsonSerializable

      `JsonSerializable.Base`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TypeBindings` | `_bindings` Bindings in effect for this type instance; possibly empty.
    `protected JavaType` | `_superClass`
    `protected JavaType[]` | `_superInterfaces`

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

      `_asStatic, _class, _hash, _typeHandler, _valueHandler`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TypeBase(java.lang.Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInts, int hash, java.lang.Object valueHandler, java.lang.Object typeHandler, boolean asStatic)` Main constructor to use by extending classes.
    `protected` | `TypeBase(TypeBase base)` Copy-constructor used when refining/upgrading type instances.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static JavaType` | `_bogusSuperClass(java.lang.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 java.lang.StringBuilder` | `_classSignature(java.lang.Class<?> cls, java.lang.StringBuilder sb, boolean trailingSemicolon)`
    `protected java.lang.String` | `buildCanonicalName()`
    `JavaType` | `containedType(int index)`
    `int` | `containedTypeCount()`
    `java.lang.String` | `containedTypeName(int index)` Deprecated.
    `JavaType` | `findSuperType(java.lang.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(java.lang.Class<?> expType)` Method that may be used to find paramaterization this type has for given type-erased generic target type.
    `TypeBindings` | `getBindings()`
    `abstract java.lang.StringBuilder` | `getErasedSignature(java.lang.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 java.lang.StringBuilder` | `getGenericSignature(java.lang.StringBuilder sb)`
    `java.util.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(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider provider)` Serialization method called when no additional type information is to be included in serialization.
    `void` | `serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen, SerializerProvider provider, TypeSerializer typeSer)` Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.
    `java.lang.String` | `toCanonical()`

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

      `_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, refine, toString, useStaticType, withContentType, withContentTypeHandler, withContentValueHandler, withHandlersFrom, withStaticTyping, withTypeHandler, withValueHandler`

    - ### Methods inherited from class com.fasterxml.jackson.core.type.ResolvedType

      `isReferenceType`

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

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

- - ### Field Detail

    - #### _superClass

          protected final JavaType _superClass

    - #### _superInterfaces

          protected final JavaType[] _superInterfaces

    - #### _bindings

          protected final TypeBindings _bindings

      Bindings in effect for this type instance; possibly empty. Needed when resolving types declared in members of this type (if any).
      Since:
        2.7

  - ### Constructor Detail

    - #### TypeBase

          protected TypeBase(java.lang.Class<?> raw,
                  TypeBindings bindings,
                  JavaType superClass,
                  JavaType[] superInts,
                  int hash,
                  java.lang.Object valueHandler,
                  java.lang.Object typeHandler,
                  boolean asStatic)

      Main constructor to use by extending classes.

    - #### TypeBase

          protected TypeBase(TypeBase base)

      Copy-constructor used when refining/upgrading type instances.
      Since:
        2.7

  - ### Method Detail

    - #### toCanonical

          public java.lang.String toCanonical()

      Specified by:
        `toCanonical` in class `com.fasterxml.jackson.core.type.ResolvedType`

    - #### buildCanonicalName

          protected java.lang.String buildCanonicalName()

    - #### getGenericSignature

          public abstract java.lang.StringBuilder getGenericSignature(java.lang.StringBuilder sb)

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

    - #### getErasedSignature

          public abstract java.lang.StringBuilder getErasedSignature(java.lang.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 `JavaType`
      Parameters:
        `sb` - StringBuilder to append signature to
      Returns:
        StringBuilder that was passed in; returned to allow call chaining

    - #### getBindings

          public TypeBindings getBindings()

      Specified by:
        `getBindings` in class `JavaType`

    - #### containedTypeCount

          public int containedTypeCount()

      Specified by:
        `containedTypeCount` in class `JavaType`

    - #### containedType

          public JavaType containedType(int index)

      Specified by:
        `containedType` in class `JavaType`

    - #### containedTypeName

          @Deprecated
          public java.lang.String containedTypeName(int index)

      Deprecated.
      Specified by:
        `containedTypeName` in class `JavaType`

    - #### getSuperClass

          public JavaType getSuperClass()

      Description copied from class: `JavaType`
      Accessor for finding fully resolved parent class of this type, if it has one; null if not.
      Specified by:
        `getSuperClass` in class `JavaType`

    - #### getInterfaces

          public java.util.List<JavaType> getInterfaces()

      Description copied from class: `JavaType`
      Accessor for finding fully resolved interfaces this type implements, if any; empty array if none.
      Specified by:
        `getInterfaces` in class `JavaType`

    - #### findSuperType

          public final JavaType findSuperType(java.lang.Class<?> rawTarget)

      Description copied from class: `JavaType`
      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.
      Specified by:
        `findSuperType` in class `JavaType`

    - #### findTypeParameters

          public JavaType[] findTypeParameters(java.lang.Class<?> expType)

      Description copied from class: `JavaType`
      Method that may be used to find paramaterization this type has for given type-erased generic target type.
      Specified by:
        `findTypeParameters` in class `JavaType`

    - #### serializeWithType

          public void serializeWithType(com.fasterxml.jackson.core.JsonGenerator gen,
                               SerializerProvider provider,
                               TypeSerializer typeSer)
                                 throws java.io.IOException,
                                        com.fasterxml.jackson.core.JsonProcessingException

      Description copied from interface: `JsonSerializable`
      Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.

      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.

      Specified by:
        `serializeWithType` in interface `JsonSerializable`
      Throws:
        `java.io.IOException`
        `com.fasterxml.jackson.core.JsonProcessingException`

    - #### serialize

          public void serialize(com.fasterxml.jackson.core.JsonGenerator gen,
                       SerializerProvider provider)
                         throws java.io.IOException,
                                com.fasterxml.jackson.core.JsonProcessingException

      Description copied from interface: `JsonSerializable`
      Serialization method called when no additional type information is to be included in serialization.
      Specified by:
        `serialize` in interface `JsonSerializable`
      Throws:
        `java.io.IOException`
        `com.fasterxml.jackson.core.JsonProcessingException`

    - #### _classSignature

          protected static java.lang.StringBuilder _classSignature(java.lang.Class<?> cls,
                                                java.lang.StringBuilder sb,
                                                boolean trailingSemicolon)

      Parameters:
        `trailingSemicolon` - Whether to add trailing semicolon for non-primitive (reference) types or not

    - #### _bogusSuperClass

          protected static JavaType _bogusSuperClass(java.lang.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. Will basically give `JavaType` for `java.lang.Object` for classes other than `java.lafgn.Object`; null for others.
      Since:
        2.7