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, Serializable, Type
  Direct Known Subclasses:
    ArrayType, CollectionLikeType, MapLikeType, 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 inherited from class com.fasterxml.jackson.databind.JavaType

      `_asStatic, _class, _hash, _typeHandler, _valueHandler`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `TypeBase(Class<?> raw, int hash, Object valueHandler, Object typeHandler)` Deprecated. Since 2.2 use method that takes 'asStatic' argument
    `protected` | `TypeBase(Class<?> raw, int hash, Object valueHandler, Object typeHandler, boolean asStatic)` Main constructor to use by extending classes.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected static StringBuilder` | `_classSignature(Class<?> cls, StringBuilder sb, boolean trailingSemicolon)`
    `protected abstract String` | `buildCanonicalName()`
    `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)`
    `<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(com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider)` Serialization method called when no additional type information is to be included in serialization.
    `void` | `serializeWithType(com.fasterxml.jackson.core.JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer)` Serialization method called when additional type information is expected to be included in serialization, for deserialization to use.
    `String` | `toCanonical()`

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

      `_assertSubclass, _narrow, _widen, containedType, containedTypeCount, containedTypeName, containedTypeOrUnknown, equals, forcedNarrowBy, getContentType, getErasedSignature, getGenericSignature, getKeyType, getParameterSource, getRawClass, getReferencedType, hasGenericTypes, hashCode, hasRawClass, hasValueHandler, isAbstract, isArrayType, isCollectionLikeType, isConcrete, isContainerType, isEnumType, isFinal, isInterface, isJavaLangObject, isMapLikeType, isPrimitive, isThrowable, isTypeOrSubTypeOf, narrowBy, narrowContentsBy, toString, useStaticType, widenBy, widenContentsBy, withContentTypeHandler, withContentValueHandler, 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`

    - ### Methods inherited from interface java.lang.reflect.Type

      `getTypeName`

- - ### Constructor Detail

    - #### TypeBase

          @Deprecated
          protected TypeBase(Class<?> raw,
                                         int hash,
                                         Object valueHandler,
                                         Object typeHandler)

      Deprecated. Since 2.2 use method that takes 'asStatic' argument

    - #### TypeBase

          protected TypeBase(Class<?> raw,
                             int hash,
                             Object valueHandler,
                             Object typeHandler,
                             boolean asStatic)

      Main constructor to use by extending classes.

  - ### Method Detail

    - #### toCanonical

          public String toCanonical()

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

    - #### buildCanonicalName

          protected abstract String buildCanonicalName()

    - #### getGenericSignature

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

    - #### getValueHandler

          public <T> T getValueHandler()

      Description copied from class: `JavaType`
      Method for accessing value handler associated with this type, if any
      Overrides:
        `getValueHandler` in class `JavaType`

    - #### getTypeHandler

          public <T> T getTypeHandler()

      Description copied from class: `JavaType`
      Method for accessing type handler associated with this type, if any
      Overrides:
        `getTypeHandler` in class `JavaType`

    - #### serializeWithType

          public void serializeWithType(com.fasterxml.jackson.core.JsonGenerator jgen,
                                        SerializerProvider provider,
                                        TypeSerializer typeSer)
                                 throws 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:
        `IOException`
        `com.fasterxml.jackson.core.JsonProcessingException`

    - #### serialize

          public void serialize(com.fasterxml.jackson.core.JsonGenerator jgen,
                                SerializerProvider provider)
                         throws 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:
        `IOException`
        `com.fasterxml.jackson.core.JsonProcessingException`

    - #### _classSignature

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

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

Copyright © 2014–2015 FasterXML. All rights reserved.