public abstract class ParentTypeAwareTypeInformation<S> extends Object
TypeInformation
implementations that need parent type awareness.Modifier | Constructor and Description |
---|---|
protected |
ParentTypeAwareTypeInformation(Type type,
org.springframework.data.util.TypeDiscoverer<?> parent,
Map<TypeVariable,Type> map)
Creates a new
ParentTypeAwareTypeInformation . |
Modifier and Type | Method and Description |
---|---|
protected TypeInformation<?> |
createInfo(Type fieldType)
Creates
TypeInformation for the given Type . |
boolean |
equals(Object obj) |
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
Collection s or the key type for Map s. |
TypeInformation<?> |
getMapValueType()
Will return the type of the value in case the underlying type is a
Map . |
List<TypeInformation<?>> |
getParameterTypes(Constructor<?> constructor)
Returns the
TypeInformation s for the parameters of the given Constructor . |
List<TypeInformation<?>> |
getParameterTypes(Method method)
Returns the
TypeInformation s for the parameters of the given Method . |
TypeInformation<?> |
getProperty(String fieldname)
Returns the property information for the property with the given name.
|
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()
Considers the parent's type variable map before invoking the super class method.
|
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 . |
protected ParentTypeAwareTypeInformation(Type type, org.springframework.data.util.TypeDiscoverer<?> parent, Map<TypeVariable,Type> map)
ParentTypeAwareTypeInformation
.type
- parent
- map
- protected Map<TypeVariable,Type> getTypeVariableMap()
protected TypeInformation<?> createInfo(Type fieldType)
TypeInformation
for the given Type
.public boolean equals(Object obj)
public int hashCode()
protected Class<S> resolveType(Type type)
Class
.type
- public List<TypeInformation<?>> getParameterTypes(Constructor<?> constructor)
TypeInformation
TypeInformation
s for the parameters of the given Constructor
.getParameterTypes
in interface TypeInformation<S>
constructor
- must not be null.public TypeInformation<?> getProperty(String fieldname)
TypeInformation
getProperty
in interface TypeInformation<S>
public Class<S> getType()
TypeInformation
getType
in interface TypeInformation<S>
public TypeInformation<?> getActualType()
TypeInformation
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.getActualType
in interface TypeInformation<S>
public boolean isMap()
TypeInformation
Map
. If this returns true you can expect
TypeInformation.getComponentType()
as well as TypeInformation.getMapValueType()
to return something not null.isMap
in interface TypeInformation<S>
public TypeInformation<?> getMapValueType()
TypeInformation
Map
.getMapValueType
in interface TypeInformation<S>
public boolean isCollectionLike()
TypeInformation
Collection
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>
public TypeInformation<?> getComponentType()
TypeInformation
Collection
s or the key type for Map
s.getComponentType
in interface TypeInformation<S>
public TypeInformation<?> getReturnType(Method method)
TypeInformation
TypeInformation
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)
TypeInformation
TypeInformation
s for the parameters of the given Method
.getParameterTypes
in interface TypeInformation<S>
method
- must not be null.public TypeInformation<?> getSuperTypeInformation(Class<?> superType)
TypeInformation
TypeInformation
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()
TypeInformation
TypeInformation
for the type arguments of the current TypeInformation
.getTypeArguments
in interface TypeInformation<S>
public boolean isAssignableFrom(TypeInformation<?> target)
TypeInformation
TypeInformation
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>
Copyright © 2011-2013-2014 Pivotal. All Rights Reserved.