org.codehaus.jackson.type
Class JavaType

java.lang.Object
  extended by org.codehaus.jackson.type.JavaType
Direct Known Subclasses:
ArrayType, CollectionType, MapType, SimpleType

public abstract class JavaType
extends java.lang.Object

Base class for type token classes used both to contain information and as keys for deserializers.

Instances can (only) be constructed by TypeFactory.


Field Summary
protected  java.lang.Class<?> _class
          This is the nominal type-erased Class that would be close to the type represented (but not exactly type, due to type erasure: type instance may have more information on this).
protected  int _hashCode
           
 
Constructor Summary
protected JavaType(java.lang.Class<?> clz)
           
 
Method Summary
protected  void _assertSubclass(java.lang.Class<?> subclass, java.lang.Class<?> superClass)
           
protected abstract  JavaType _narrow(java.lang.Class<?> subclass)
           
abstract  boolean equals(java.lang.Object o)
           
 java.lang.Class<?> getRawClass()
           
 int hashCode()
           
 boolean hasRawClass(java.lang.Class<?> clz)
          Method that can be used to check whether this type has specified Class as its type erasure.
 boolean isAbstract()
           
 boolean isArrayType()
           
abstract  boolean isContainerType()
           
 boolean isEnumType()
           
abstract  boolean isFullyTyped()
          Method that can be used to check whether type described is fully typed, regarding the way JavaTypes are used for deserialization.
 boolean isInterface()
           
 boolean isPrimitive()
           
 JavaType narrowBy(java.lang.Class<?> subclass)
          Method that can be called to do a "narrowing" conversions; that is, to return a type with a raw class that is assignable to the raw class of this type.
abstract  JavaType narrowContentsBy(java.lang.Class<?> contentClass)
           
abstract  java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_class

protected final java.lang.Class<?> _class
This is the nominal type-erased Class that would be close to the type represented (but not exactly type, due to type erasure: type instance may have more information on this). May be an interface or abstract class, so instantiation may not be possible.


_hashCode

protected int _hashCode
Constructor Detail

JavaType

protected JavaType(java.lang.Class<?> clz)
Method Detail

narrowBy

public final JavaType narrowBy(java.lang.Class<?> subclass)
Method that can be called to do a "narrowing" conversions; that is, to return a type with a raw class that is assignable to the raw class of this type. If this is not possible, an IllegalArgumentException is thrown. If class is same as the current raw class, instance itself is returned.


_narrow

protected abstract JavaType _narrow(java.lang.Class<?> subclass)

narrowContentsBy

public abstract JavaType narrowContentsBy(java.lang.Class<?> contentClass)

getRawClass

public final java.lang.Class<?> getRawClass()

hasRawClass

public final boolean hasRawClass(java.lang.Class<?> clz)
Method that can be used to check whether this type has specified Class as its type erasure. Put another way, returns true if instantiation of this Type is given (type-erased) Class.


isFullyTyped

public abstract boolean isFullyTyped()
Method that can be used to check whether type described is fully typed, regarding the way JavaTypes are used for deserialization. For this to be true, all Collection and Map types must have proper element/value/key type information, and can not be plain classes.


isContainerType

public abstract boolean isContainerType()
Returns:
True if type represented is a container type; this includes array, Map and Collection types.

isAbstract

public final boolean isAbstract()

isArrayType

public final boolean isArrayType()

isEnumType

public final boolean isEnumType()

isInterface

public final boolean isInterface()

isPrimitive

public final boolean isPrimitive()

_assertSubclass

protected void _assertSubclass(java.lang.Class<?> subclass,
                               java.lang.Class<?> superClass)

toString

public abstract java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public abstract boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object