Added TypeInformation.getActualType().
The method transparently resolves the property type, collection component type or map value type depending on what the core type is.
This commit is contained in:
@@ -219,6 +219,19 @@ class TypeDiscoverer<S> implements TypeInformation<S> {
|
||||
public Class<S> getType() {
|
||||
return resolveType(type);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.util.TypeInformation#getActualType()
|
||||
*/
|
||||
public TypeInformation<?> getActualType() {
|
||||
if (isMap()) {
|
||||
return getMapValueType();
|
||||
} else if (isCollectionLike()) {
|
||||
return getComponentType();
|
||||
} else {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.data.util.TypeInformation#isMap()
|
||||
|
||||
@@ -64,4 +64,12 @@ public interface TypeInformation<S> {
|
||||
* @return
|
||||
*/
|
||||
Class<S> getType();
|
||||
|
||||
/**
|
||||
* Transparently returns the {@link Map} value type if the type is a {@link Map}, returns the component type if the
|
||||
* type {@link #isCollectionLike()} or the simple type if none of this applies.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
TypeInformation<?> getActualType();
|
||||
}
|
||||
Reference in New Issue
Block a user