java.lang.Object
io.lettuce.core.dynamic.support.TypeVariableTypeInformation<T>
- All Implemented Interfaces:
TypeInformation<T>
public class TypeVariableTypeInformation<T> extends Object
Special
TypeDiscoverer to determine the actual type for a TypeVariable. Will consider the context the
TypeVariable is being used in.-
Constructor Summary
Constructors Constructor Description TypeVariableTypeInformation(TypeVariable<?> variable, Type owningType, io.lettuce.core.dynamic.support.TypeDiscoverer<?> parent, Map<TypeVariable<?>,Type> typeVariableMap)Creates a bewTypeVariableTypeInformationfor the givenTypeVariableowningTypeand parentTypeDiscoverer. -
Method Summary
Modifier and Type Method Description protected TypeInformation<?>createInfo(Type fieldType)CreatesTypeInformationfor the givenType.protected TypeInformation<?>doGetComponentType()protected TypeInformation<?>doGetMapValueType()booleanequals(Object obj)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<T>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.StringgetVariableName()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<T>resolveClass(Type type)Resolves the given type into a plainClass.protected TyperesolveType(Type type)Resolves the given type into aType.StringtoString()
-
Constructor Details
-
TypeVariableTypeInformation
public TypeVariableTypeInformation(TypeVariable<?> variable, Type owningType, io.lettuce.core.dynamic.support.TypeDiscoverer<?> parent, Map<TypeVariable<?>,Type> typeVariableMap)Creates a bewTypeVariableTypeInformationfor the givenTypeVariableowningTypeand parentTypeDiscoverer.- Parameters:
variable- must not benullowningType- must not benullparent- can be benulltypeVariableMap- must not benull
-
-
Method Details
-
getType
Description copied from interface:TypeInformationReturns the type of the property. Will resolve generics and the generic context of- Specified by:
getTypein interfaceTypeInformation<T>- Returns:
-
getTypeArguments
Description copied from interface:TypeInformationReturns theTypeInformationfor the type arguments of the currentTypeInformation.- Specified by:
getTypeArgumentsin interfaceTypeInformation<T>- Returns:
-
equals
-
hashCode
public int hashCode() -
toString
-
getVariableName
-
createInfo
CreatesTypeInformationfor the givenType.- Returns:
-
getTypeVariableMap
Returns the type variable map.- Specified by:
getTypeVariableMapin interfaceTypeInformation<S>- 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>
-
getRawTypeInformation
Description copied from interface:TypeInformationReturns aClassTypeInformationto represent theTypeInformationof the raw type of the current instance.- Specified by:
getRawTypeInformationin interfaceTypeInformation<S>- Returns:
-
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.
-
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:
-
getTypeArgument
-