org.codehaus.jackson.map.type
Class MapType

java.lang.Object
  extended by org.codehaus.jackson.type.JavaType
      extended by org.codehaus.jackson.map.type.TypeBase
          extended by org.codehaus.jackson.map.type.MapType

public final class MapType
extends TypeBase

Type that represents Java Map types.


Field Summary
 
Fields inherited from class org.codehaus.jackson.type.JavaType
_class, _hashCode, _typeHandler, _valueHandler
 
Method Summary
protected  JavaType _narrow(Class<?> subclass)
           
protected  String buildCanonicalName()
           
static MapType construct(Class<?> rawType, JavaType keyT, JavaType valueT)
           
 JavaType containedType(int index)
          Method for accessing definitions of contained ("child") types.
 int containedTypeCount()
          Method for checking how many contained types this type has.
 String containedTypeName(int index)
          Not sure if we should count on this, but type names for core interfaces are "K" and "V" respectively.
 boolean equals(Object o)
           
 JavaType getContentType()
          Method for accessing content type of this type, if type has such a thing: simple types do not, structured types do (like arrays, Collections and Maps)
 JavaType getKeyType()
          Method for accessing key type for this type, assuming type has such a concept (only Map types do)
 boolean isContainerType()
           
 JavaType narrowContentsBy(Class<?> contentClass)
           
 JavaType narrowKey(Class<?> keySubclass)
           
 String toString()
           
 
Methods inherited from class org.codehaus.jackson.map.type.TypeBase
copyHandlers, toCanonical
 
Methods inherited from class org.codehaus.jackson.type.JavaType
_assertSubclass, _widen, forcedNarrowBy, getRawClass, getTypeHandler, getValueHandler, hashCode, hasRawClass, isAbstract, isArrayType, isConcrete, isEnumType, isFinal, isInterface, isPrimitive, isThrowable, narrowBy, setTypeHandler, setValueHandler, widenBy
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

construct

public static MapType construct(Class<?> rawType,
                                JavaType keyT,
                                JavaType valueT)

_narrow

protected JavaType _narrow(Class<?> subclass)
Specified by:
_narrow in class JavaType

narrowContentsBy

public JavaType narrowContentsBy(Class<?> contentClass)
Specified by:
narrowContentsBy in class JavaType

narrowKey

public JavaType narrowKey(Class<?> keySubclass)

buildCanonicalName

protected String buildCanonicalName()
Specified by:
buildCanonicalName in class TypeBase

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.

getKeyType

public JavaType getKeyType()
Description copied from class: JavaType
Method for accessing key type for this type, assuming type has such a concept (only Map types do)

Overrides:
getKeyType in class JavaType

getContentType

public JavaType getContentType()
Description copied from class: JavaType
Method for accessing content type of this type, if type has such a thing: simple types do not, structured types do (like arrays, Collections and Maps)

Overrides:
getContentType in class JavaType

containedTypeCount

public int containedTypeCount()
Description copied from class: JavaType
Method for checking how many contained types this type has. Contained types are usually generic types, so that generic Maps have 2 contained types.

Overrides:
containedTypeCount in class JavaType

containedType

public JavaType containedType(int index)
Description copied from class: JavaType
Method for accessing definitions of contained ("child") types.

Overrides:
containedType in class JavaType
Parameters:
index - Index of contained type to return
Returns:
Contained type at index, or null if no such type exists (no exception thrown)

containedTypeName

public String containedTypeName(int index)
Not sure if we should count on this, but type names for core interfaces are "K" and "V" respectively. For now let's assume this should work.

Overrides:
containedTypeName in class JavaType
Parameters:
index - Index of contained type to return
Returns:
Contained type at index, or null if no such type exists (no exception thrown)

toString

public String toString()
Specified by:
toString in class JavaType

equals

public boolean equals(Object o)
Specified by:
equals in class JavaType