public class ClassTypeInformation<S> extends Object
TypeInformation for a plain Class.| Modifier and Type | Field and Description |
|---|---|
static ClassTypeInformation<Collection> |
COLLECTION |
static ClassTypeInformation<List> |
LIST |
static ClassTypeInformation<Map> |
MAP |
static ClassTypeInformation<Object> |
OBJECT |
static ClassTypeInformation<Set> |
SET |
| Modifier and Type | Method and Description |
|---|---|
protected TypeInformation<?> |
createInfo(Type fieldType)
Creates
TypeInformation for the given Type. |
protected TypeInformation<?> |
doGetComponentType() |
protected TypeInformation<?> |
doGetMapValueType() |
boolean |
equals(Object obj) |
static <S> ClassTypeInformation<S> |
from(Class<S> type)
Simple factory method to easily create new instances of
ClassTypeInformation. |
static <S> TypeInformation<S> |
fromReturnTypeOf(Method method)
Creates a
TypeInformation from the given method's return type. |
TypeInformation<?> |
getActualType()
Transparently returns the
Map value type if the type is a Map, returns the
component type if the type TypeInformation.isCollectionLike() or the simple type if none of this applies. |
TypeInformation<?> |
getComponentType()
Returns the component type for
Collections or the key type for Maps. |
TypeInformation<?> |
getMapValueType()
Will return the type of the value in case the underlying type is a
Map. |
List<TypeInformation<?>> |
getParameterTypes(Constructor<?> constructor)
Returns the
TypeInformations for the parameters of the given Constructor. |
List<TypeInformation<?>> |
getParameterTypes(Method method)
Returns the
TypeInformations for the parameters of the given Method. |
TypeInformation<?> |
getProperty(String fieldname)
Returns the property information for the property with the given name.
|
ClassTypeInformation<?> |
getRawTypeInformation()
Returns a
ClassTypeInformation to represent the TypeInformation of the raw type of the current
instance. |
TypeInformation<?> |
getReturnType(Method method)
Returns a
TypeInformation for the return type of the given Method. |
TypeInformation<?> |
getSuperTypeInformation(Class<?> superType)
Returns the
TypeInformation for the given raw super type. |
Class<S> |
getType()
Returns the type of the property.
|
List<TypeInformation<?>> |
getTypeArguments()
Returns the
TypeInformation for the type arguments of the current TypeInformation. |
protected Map<TypeVariable<?>,Type> |
getTypeVariableMap()
Returns the type variable map.
|
int |
hashCode() |
boolean |
isAssignableFrom(TypeInformation<?> target)
Returns if the current
TypeInformation can be safely assigned to the given one. |
boolean |
isCollectionLike()
Returns whether the type can be considered a collection, which means it's a container of elements, e.g. a
Collection and Array or anything implementing Iterable. |
boolean |
isMap()
Returns whether the property is a
Map. |
protected Class<S> |
resolveType(Type type)
Resolves the given type into a plain
Class. |
TypeInformation<? extends S> |
specialize(ClassTypeInformation<?> type)
Specializes the given (raw)
ClassTypeInformation using the context of the current potentially parameterized
type, basically turning the given raw type into a parameterized one. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetRequiredActualType, getRequiredComponentType, getRequiredMapValueType, getRequiredProperty, getRequiredSuperTypeInformation, isSubTypeOfpublic static final ClassTypeInformation<Collection> COLLECTION
public static final ClassTypeInformation<List> LIST
public static final ClassTypeInformation<Set> SET
public static final ClassTypeInformation<Map> MAP
public static final ClassTypeInformation<Object> OBJECT
public static <S> ClassTypeInformation<S> from(Class<S> type)
ClassTypeInformation.S - type - must not be null.public static <S> TypeInformation<S> fromReturnTypeOf(Method method)
TypeInformation from the given method's return type.method - must not be null.public Class<S> getType()
TypeInformationgetType in interface TypeInformation<S>public ClassTypeInformation<?> getRawTypeInformation()
TypeInformationClassTypeInformation to represent the TypeInformation of the raw type of the current
instance.getRawTypeInformation in interface TypeInformation<S>public boolean isAssignableFrom(TypeInformation<?> target)
TypeInformationTypeInformation can be safely assigned to the given one. Mimics semantics of
Class.isAssignableFrom(Class) but takes generics into account. Thus it will allow to detect that a
List<Long> is assignable to List<? extends Number>.isAssignableFrom in interface TypeInformation<S>public TypeInformation<? extends S> specialize(ClassTypeInformation<?> type)
TypeInformationClassTypeInformation using the context of the current potentially parameterized
type, basically turning the given raw type into a parameterized one. Will return the given type as is if no
generics are involved.specialize in interface TypeInformation<S>type - must not be null.protected Map<TypeVariable<?>,Type> getTypeVariableMap()
protected TypeInformation<?> createInfo(Type fieldType)
TypeInformation for the given Type.fieldType - must not be null.protected Class<S> resolveType(Type type)
Class.type - public List<TypeInformation<?>> getParameterTypes(Constructor<?> constructor)
TypeInformationTypeInformations for the parameters of the given Constructor.getParameterTypes in interface TypeInformation<S>constructor - must not be null.@Nullable public TypeInformation<?> getProperty(String fieldname)
TypeInformationgetProperty in interface TypeInformation<S>@Nullable public TypeInformation<?> getActualType()
TypeInformationMap value type if the type is a Map, returns the
component type if the type TypeInformation.isCollectionLike() or the simple type if none of this applies.getActualType in interface TypeInformation<S>Map or Collection.public boolean isMap()
TypeInformationMap. If this returns true you can expect
TypeInformation.getComponentType() as well as TypeInformation.getMapValueType() to return something not null.isMap in interface TypeInformation<S>@Nullable public TypeInformation<?> getMapValueType()
TypeInformationMap.getMapValueType in interface TypeInformation<S>@Nullable protected TypeInformation<?> doGetMapValueType()
public boolean isCollectionLike()
TypeInformationCollection and Array or anything implementing Iterable. If this
returns true you can expect TypeInformation.getComponentType() to return a non-null value.isCollectionLike in interface TypeInformation<S>@Nullable public final TypeInformation<?> getComponentType()
TypeInformationCollections or the key type for Maps.getComponentType in interface TypeInformation<S>@Nullable protected TypeInformation<?> doGetComponentType()
public TypeInformation<?> getReturnType(Method method)
TypeInformationTypeInformation for the return type of the given Method. Will potentially resolve
generics information against the current types type parameter bindings.getReturnType in interface TypeInformation<S>method - must not be null.public List<TypeInformation<?>> getParameterTypes(Method method)
TypeInformationTypeInformations for the parameters of the given Method.getParameterTypes in interface TypeInformation<S>method - must not be null.@Nullable public TypeInformation<?> getSuperTypeInformation(Class<?> superType)
TypeInformationTypeInformation for the given raw super type.getSuperTypeInformation in interface TypeInformation<S>superType - must not be null.TypeInformation for the given raw super type or null in case the current
TypeInformation does not implement the given type.public List<TypeInformation<?>> getTypeArguments()
TypeInformationTypeInformation for the type arguments of the current TypeInformation.getTypeArguments in interface TypeInformation<S>Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.