Class TypeBase

java.lang.Object
tools.jackson.core.type.ResolvedType
tools.jackson.databind.JavaType
tools.jackson.databind.type.TypeBase
All Implemented Interfaces:
Serializable, Type, JacksonSerializable
Direct Known Subclasses:
ArrayType, CollectionLikeType, IdentityEqualityType, MapLikeType, SimpleType

public abstract class TypeBase extends JavaType implements JacksonSerializable
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • NO_BINDINGS

      private static final TypeBindings NO_BINDINGS
    • NO_TYPES

      private static final JavaType[] NO_TYPES
    • _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).
    • _canonicalName

      transient volatile String _canonicalName
      Lazily initialized external representation of the type
  • Constructor Details

    • TypeBase

      protected TypeBase(Class<?> raw, TypeBindings bindings, JavaType superClass, JavaType[] superInts, int hash, Object valueHandler, Object typeHandler, boolean asStatic)
      Main constructor to use by extending classes.
    • TypeBase

      protected TypeBase(TypeBase base)
      Copy-constructor used when refining/upgrading type instances.
  • Method Details

    • toCanonical

      public String toCanonical()
      Specified by:
      toCanonical in class tools.jackson.core.type.ResolvedType
    • buildCanonicalName

      protected 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
    • 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
    • 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 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(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(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(tools.jackson.core.JsonGenerator g, SerializationContext ctxt, TypeSerializer typeSer) throws tools.jackson.core.JacksonException
      Description copied from interface: JacksonSerializable
      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 TypeSerializer.writeTypePrefix(JsonGenerator, SerializationContext, WritableTypeId) followed by serialization of contents, followed by a call to TypeSerializer.writeTypeSuffix(JsonGenerator, SerializationContext, WritableTypeId)). Details of the type id argument to pass 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 JacksonSerializable
      Throws:
      tools.jackson.core.JacksonException
    • serialize

      public void serialize(tools.jackson.core.JsonGenerator gen, SerializationContext ctxt) throws tools.jackson.core.JacksonException
      Description copied from interface: JacksonSerializable
      Serialization method called when no additional type information is to be included in serialization.
      Specified by:
      serialize in interface JacksonSerializable
      Throws:
      tools.jackson.core.JacksonException
    • _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
    • _hasNTypeParameters

      protected boolean _hasNTypeParameters(int count)