- All Known Implementing Classes:
ClassTypeInformation,TypeVariableTypeInformation
public interface TypeInformation<S>
Interface to access types and resolving generics on the way.
-
Method Summary
Modifier and Type Method Description TypeInformation<?>getActualType()Transparently returns theMapvalue type if the type is aMap, returns the component type if the typeisCollectionLike()or the simple type if none of this applies.TypeInformation<?>getComponentType()Returns the component type forCollections or the key type forMaps.TypegetGenericType()TypeInformation<?>getMapValueType()Will return the type of the value in case the underlying type is aMap.List<TypeInformation<?>>getParameterTypes(Constructor<?> constructor)Returns theTypeInformations for the parameters of the givenConstructor.List<TypeInformation<?>>getParameterTypes(Method method)Returns theTypeInformations for the parameters of the givenMethod.ClassTypeInformation<?>getRawTypeInformation()Returns aClassTypeInformationto represent theTypeInformationof the raw type of the current instance.TypeInformation<?>getReturnType(Method method)Returns aTypeInformationfor the return type of the givenMethod.TypeInformation<?>getSuperTypeInformation(Class<?> superType)Returns theTypeInformationfor the given raw super type.Class<S>getType()Returns the type of the property.List<TypeInformation<?>>getTypeArguments()Returns theTypeInformationfor the type arguments of the currentTypeInformation.Map<TypeVariable<?>,Type>getTypeVariableMap()booleanisAssignableFrom(TypeInformation<?> target)Returns if the currentTypeInformationcan be safely assigned to the given one.booleanisCollectionLike()Returns whether the type can be considered a collection, which means it's a container of elements, e.g.booleanisMap()Returns whether the property is aMap.
-
Method Details
-
getGenericType
Type getGenericType() -
getParameterTypes
Returns theTypeInformations for the parameters of the givenConstructor.- Parameters:
constructor- must not benull.- Returns:
-
isCollectionLike
boolean isCollectionLike()Returns whether the type can be considered a collection, which means it's a container of elements, e.g. aCollectionandArrayor anything implementingIterable. If this returnstrueyou can expectgetComponentType()to return a non-nullvalue.- Returns:
-
getComponentType
TypeInformation<?> getComponentType()Returns the component type forCollections or the key type forMaps.- Returns:
-
isMap
boolean isMap()Returns whether the property is aMap. If this returnstrueyou can expectgetComponentType()as well asgetMapValueType()to return something notnull.- Returns:
-
getMapValueType
TypeInformation<?> getMapValueType()Will return the type of the value in case the underlying type is aMap.- Returns:
-
getType
Returns the type of the property. Will resolve generics and the generic context of- Returns:
-
getRawTypeInformation
ClassTypeInformation<?> getRawTypeInformation()Returns aClassTypeInformationto represent theTypeInformationof the raw type of the current instance.- Returns:
-
getActualType
TypeInformation<?> getActualType()Transparently returns theMapvalue type if the type is aMap, returns the component type if the typeisCollectionLike()or the simple type if none of this applies.- Returns:
-
getReturnType
Returns aTypeInformationfor the return type of the givenMethod. Will potentially resolve generics information against the current types type parameter bindings.- Parameters:
method- must not benull.- Returns:
-
getParameterTypes
Returns theTypeInformations for the parameters of the givenMethod.- Parameters:
method- must not benull.- Returns:
-
getSuperTypeInformation
Returns theTypeInformationfor the given raw super type.- Parameters:
superType- must not benull.- Returns:
- the
TypeInformationfor the given raw super type ornullin case the currentTypeInformationdoes not implement the given type.
-
isAssignableFrom
Returns if the currentTypeInformationcan be safely assigned to the given one. Mimics semantics ofClass.isAssignableFrom(Class)but takes generics into account. Thus it will allow to detect that aList<Long>is assignable toList<? extends Number>.- Parameters:
target-- Returns:
-
getTypeArguments
List<TypeInformation<?>> getTypeArguments()Returns theTypeInformationfor the type arguments of the currentTypeInformation.- Returns:
-
getTypeVariableMap
Map<TypeVariable<?>,Type> getTypeVariableMap()
-