org.springframework.data.util

## Class ParentTypeAwareTypeInformation<S>

- java.lang.Object
- - org.springframework.data.util.ParentTypeAwareTypeInformation<S>

All Implemented Interfaces:
  TypeInformation<S>

    public abstract class ParentTypeAwareTypeInformation<S>
    extends Object

Base class for `TypeInformation` implementations that need parent type awareness.

Author:
  Oliver Gierke

### Constructor Summary

Constructors
`protected` `ParentTypeAwareTypeInformation(Type type, org.springframework.data.util.TypeDiscoverer<?> parent)` Creates a new `ParentTypeAwareTypeInformation`.
`protected` `ParentTypeAwareTypeInformation(Type type, org.springframework.data.util.TypeDiscoverer<?> parent, Map<TypeVariable<?>,Type> map)`

### Method Summary

All Methods Instance Methods Concrete Methods
`protected TypeInformation<?>` `createInfo(Type fieldType)` Creates `TypeInformation` for the given `Type`.
`protected TypeInformation<?>` `doGetComponentType()`
`protected TypeInformation<?>` `doGetMapValueType()`
`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.
`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.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.springframework.data.util.TypeInformation

`getRequiredActualType, getRequiredComponentType, getRequiredMapValueType, getRequiredProperty, getRequiredSuperTypeInformation, isSubTypeOf`

### Constructor Detail

#### ParentTypeAwareTypeInformation

    protected ParentTypeAwareTypeInformation(Type type,
                                             org.springframework.data.util.TypeDiscoverer<?> parent)

Creates a new `ParentTypeAwareTypeInformation`.

Parameters:
  `type` - must not be null.
  `parent` - must not be null.

#### ParentTypeAwareTypeInformation

    protected ParentTypeAwareTypeInformation(Type type,
                                             org.springframework.data.util.TypeDiscoverer<?> parent,
                                             Map<TypeVariable<?>,Type> map)

### Method Detail

#### createInfo

    protected TypeInformation<?> createInfo(Type fieldType)

Creates `TypeInformation` for the given `Type`.

Parameters:
  `fieldType` - must not be null.
Returns:

#### equals

    public boolean equals(@Nullable
                          Object obj)

#### hashCode

    public int hashCode()

#### getTypeVariableMap

    protected Map<TypeVariable<?>,Type> getTypeVariableMap()

Returns the type variable map.

Returns:

#### resolveType

    protected Class<S> resolveType(Type type)

Resolves the given type into a plain `Class`.

Parameters:
  `type` -
Returns:

#### getParameterTypes

    public List<TypeInformation<?>> getParameterTypes(Constructor<?> constructor)

Description copied from interface: `TypeInformation`
Returns the `TypeInformation`s for the parameters of the given `Constructor`.

Specified by:
  `getParameterTypes` in interface `TypeInformation<S>`
Parameters:
  `constructor` - must not be null.
Returns:

#### getProperty

    @Nullable
    public TypeInformation<?> getProperty(String fieldname)

Description copied from interface: `TypeInformation`
Returns the property information for the property with the given name. Supports property traversal through dot notation.

Specified by:
  `getProperty` in interface `TypeInformation<S>`
Returns:

#### getType

    public Class<S> getType()

Description copied from interface: `TypeInformation`
Returns the type of the property. Will resolve generics and the generic context of

Specified by:
  `getType` in interface `TypeInformation<S>`
Returns:

#### getRawTypeInformation

    public ClassTypeInformation<?> getRawTypeInformation()

Description copied from interface: `TypeInformation`
Returns a `ClassTypeInformation` to represent the `TypeInformation` of the raw type of the current instance.

Specified by:
  `getRawTypeInformation` in interface `TypeInformation<S>`
Returns:

#### getActualType

    @Nullable
    public TypeInformation<?> getActualType()

Description copied from interface: `TypeInformation`
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.

Specified by:
  `getActualType` in interface `TypeInformation<S>`
Returns:
  the map value, collection component type or the current type, null it the current type is a raw `Map` or `Collection`.

#### isMap

    public boolean isMap()

Description copied from interface: `TypeInformation`
Returns whether the property is a `Map`. If this returns true you can expect `TypeInformation.getComponentType()` as well as `TypeInformation.getMapValueType()` to return something not null.

Specified by:
  `isMap` in interface `TypeInformation<S>`
Returns:

#### getMapValueType

    @Nullable
    public TypeInformation<?> getMapValueType()

Description copied from interface: `TypeInformation`
Will return the type of the value in case the underlying type is a `Map`.

Specified by:
  `getMapValueType` in interface `TypeInformation<S>`
Returns:

#### doGetMapValueType

    @Nullable
    protected TypeInformation<?> doGetMapValueType()

#### isCollectionLike

    public boolean isCollectionLike()

Description copied from interface: `TypeInformation`
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`. If this returns true you can expect `TypeInformation.getComponentType()` to return a non-null value.

Specified by:
  `isCollectionLike` in interface `TypeInformation<S>`
Returns:

#### getComponentType

    @Nullable
    public final TypeInformation<?> getComponentType()

Description copied from interface: `TypeInformation`
Returns the component type for `Collection`s or the key type for `Map`s.

Specified by:
  `getComponentType` in interface `TypeInformation<S>`
Returns:

#### doGetComponentType

    @Nullable
    protected TypeInformation<?> doGetComponentType()

#### getReturnType

    public TypeInformation<?> getReturnType(Method method)

Description copied from interface: `TypeInformation`
Returns a `TypeInformation` for the return type of the given `Method`. Will potentially resolve generics information against the current types type parameter bindings.

Specified by:
  `getReturnType` in interface `TypeInformation<S>`
Parameters:
  `method` - must not be null.
Returns:

#### getParameterTypes

    public List<TypeInformation<?>> getParameterTypes(Method method)

Description copied from interface: `TypeInformation`
Returns the `TypeInformation`s for the parameters of the given `Method`.

Specified by:
  `getParameterTypes` in interface `TypeInformation<S>`
Parameters:
  `method` - must not be null.
Returns:

#### getSuperTypeInformation

    @Nullable
    public TypeInformation<?> getSuperTypeInformation(Class<?> superType)

Description copied from interface: `TypeInformation`
Returns the `TypeInformation` for the given raw super type.

Specified by:
  `getSuperTypeInformation` in interface `TypeInformation<S>`
Parameters:
  `superType` - must not be null.
Returns:
  the `TypeInformation` for the given raw super type or null in case the current `TypeInformation` does not implement the given type.

#### getTypeArguments

    public List<TypeInformation<?>> getTypeArguments()

Description copied from interface: `TypeInformation`
Returns the `TypeInformation` for the type arguments of the current `TypeInformation`.

Specified by:
  `getTypeArguments` in interface `TypeInformation<S>`
Returns:

#### isAssignableFrom

    public boolean isAssignableFrom(TypeInformation<?> target)

Description copied from interface: `TypeInformation`
Returns if the current `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>`.

Specified by:
  `isAssignableFrom` in interface `TypeInformation<S>`
Returns:

#### specialize

    public TypeInformation<? extends S> specialize(ClassTypeInformation<?> type)

Description copied from interface: `TypeInformation`
Specializes the given (raw) `ClassTypeInformation` 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.

Specified by:
  `specialize` in interface `TypeInformation<S>`
Parameters:
  `type` - must not be null.
Returns:
  will never be null.