java.lang.Object
io.lettuce.core.dynamic.support.ClassTypeInformation<S>
- All Implemented Interfaces:
TypeInformation<S>
public class ClassTypeInformation<S> extends Object
TypeInformation for a plain Class.-
Field Summary
Fields Modifier and Type Field Description static ClassTypeInformation<Collection>COLLECTIONstatic ClassTypeInformation<List>LISTstatic ClassTypeInformation<Map>MAPstatic ClassTypeInformation<Object>OBJECTstatic ClassTypeInformation<Set>SET -
Method Summary
Modifier and Type Method Description protected TypeInformation<?>createInfo(Type fieldType)CreatesTypeInformationfor the givenType.protected TypeInformation<?>doGetComponentType()protected TypeInformation<?>doGetMapValueType()booleanequals(Object obj)static <S> ClassTypeInformation<S>from(Class<S> type)Simple factory method to easily create new instances ofClassTypeInformation.static <S> TypeInformation<S>fromMethodParameter(Method method, int index)Creates aTypeInformationfrom the given method's parameter type.static <S> TypeInformation<S>fromReturnTypeOf(Method method)Creates aTypeInformationfrom the given method's return type.TypeInformation<?>getActualType()Transparently returns theMapvalue type if the type is aMap, returns the component type if the typeTypeInformation.isCollectionLike()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.TypeInformation<?>getTypeArgument(Class<?> bound, int index)List<TypeInformation<?>>getTypeArguments()Returns theTypeInformationfor the type arguments of the currentTypeInformation.Map<TypeVariable<?>,Type>getTypeVariableMap()Returns the type variable map.inthashCode()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.protected Class<S>resolveClass(Type type)Resolves the given type into a plainClass.protected TyperesolveType(Type type)Resolves the given type into aType.StringtoString()
-
Field Details
-
COLLECTION
-
LIST
-
SET
-
MAP
-
OBJECT
-
-
Method Details
-
from
Simple factory method to easily create new instances ofClassTypeInformation.- Type Parameters:
S-- Parameters:
type- must not benull.- Returns:
-
fromReturnTypeOf
Creates aTypeInformationfrom the given method's return type.- Parameters:
method- must not benull.- Returns:
-
fromMethodParameter
Creates aTypeInformationfrom the given method's parameter type.- Parameters:
method- must not benull.- Returns:
-
getType
Description copied from interface:TypeInformationReturns the type of the property. Will resolve generics and the generic context of- Specified by:
getTypein interfaceTypeInformation<S>- Returns:
-
getRawTypeInformation
Description copied from interface:TypeInformationReturns aClassTypeInformationto represent theTypeInformationof the raw type of the current instance.- Specified by:
getRawTypeInformationin interfaceTypeInformation<S>- Returns:
-
isAssignableFrom
Description copied from interface:TypeInformationReturns 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>.- Specified by:
isAssignableFromin interfaceTypeInformation<S>- Returns:
-
toString
-
getTypeVariableMap
Returns the type variable map.- Specified by:
getTypeVariableMapin interfaceTypeInformation<S>- Returns:
-
createInfo
CreatesTypeInformationfor the givenType.- Parameters:
fieldType-- Returns:
-
resolveClass
Resolves the given type into a plainClass.- Parameters:
type-- Returns:
-
resolveType
Resolves the given type into aType.- Parameters:
type-- Returns:
-
getParameterTypes
Description copied from interface:TypeInformationReturns theTypeInformations for the parameters of the givenConstructor.- Specified by:
getParameterTypesin interfaceTypeInformation<S>- Parameters:
constructor- must not benull.- Returns:
-
getGenericType
- Specified by:
getGenericTypein interfaceTypeInformation<S>
-
getActualType
Description copied from interface:TypeInformationTransparently returns theMapvalue type if the type is aMap, returns the component type if the typeTypeInformation.isCollectionLike()or the simple type if none of this applies.- Specified by:
getActualTypein interfaceTypeInformation<S>- Returns:
-
isMap
public boolean isMap()Description copied from interface:TypeInformationReturns whether the property is aMap. If this returnstrueyou can expectTypeInformation.getComponentType()as well asTypeInformation.getMapValueType()to return something notnull.- Specified by:
isMapin interfaceTypeInformation<S>- Returns:
-
getMapValueType
Description copied from interface:TypeInformationWill return the type of the value in case the underlying type is aMap.- Specified by:
getMapValueTypein interfaceTypeInformation<S>- Returns:
-
doGetMapValueType
-
isCollectionLike
public boolean isCollectionLike()Description copied from interface:TypeInformationReturns 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 expectTypeInformation.getComponentType()to return a non-nullvalue.- Specified by:
isCollectionLikein interfaceTypeInformation<S>- Returns:
-
getComponentType
Description copied from interface:TypeInformationReturns the component type forCollections or the key type forMaps.- Specified by:
getComponentTypein interfaceTypeInformation<S>- Returns:
-
doGetComponentType
-
getReturnType
Description copied from interface:TypeInformationReturns aTypeInformationfor the return type of the givenMethod. Will potentially resolve generics information against the current types type parameter bindings.- Specified by:
getReturnTypein interfaceTypeInformation<S>- Parameters:
method- must not benull.- Returns:
-
getParameterTypes
Description copied from interface:TypeInformationReturns theTypeInformations for the parameters of the givenMethod.- Specified by:
getParameterTypesin interfaceTypeInformation<S>- Parameters:
method- must not benull.- Returns:
-
getSuperTypeInformation
Description copied from interface:TypeInformationReturns theTypeInformationfor the given raw super type.- Specified by:
getSuperTypeInformationin interfaceTypeInformation<S>- Parameters:
superType- must not benull.- Returns:
- the
TypeInformationfor the given raw super type ornullin case the currentTypeInformationdoes not implement the given type.
-
getTypeArguments
Description copied from interface:TypeInformationReturns theTypeInformationfor the type arguments of the currentTypeInformation.- Specified by:
getTypeArgumentsin interfaceTypeInformation<S>- Returns:
-
getTypeArgument
-
equals
-
hashCode
public int hashCode()
-