Class SyntheticPojoGenericTypeModel<T>
- java.lang.Object
-
- org.hibernate.search.mapper.pojo.model.spi.AbstractPojoGenericTypeModel<T>
-
- org.hibernate.search.mapper.pojo.model.spi.SyntheticPojoGenericTypeModel<T>
-
- All Implemented Interfaces:
PojoGenericTypeModel<T>
,PojoTypeModel<T>
public final class SyntheticPojoGenericTypeModel<T> extends AbstractPojoGenericTypeModel<T>
An abstract base for implementations ofPojoGenericTypeModel
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> PojoGenericTypeModel<T[]>
array(PojoRawTypeModel<? super T[]> rawTypeModel, PojoGenericTypeModel<T> elementType)
Optional<PojoGenericTypeModel<?>>
arrayElementType()
<U> Optional<PojoTypeModel<? extends U>>
castTo(Class<U> target)
static <T> PojoGenericTypeModel<T>
genericType(PojoRawTypeModel<? super T> rawTypeModel, PojoGenericTypeModel<?> firstTypeArgument, PojoGenericTypeModel<?>... otherTypeArguments)
String
name()
static <T> PojoGenericTypeModel<T>
opaqueType(PojoRawTypeModel<T> rawTypeModel)
Optional<? extends PojoGenericTypeModel<?>>
typeArgument(Class<?> rawSuperType, int typeParameterIndex)
-
Methods inherited from class org.hibernate.search.mapper.pojo.model.spi.AbstractPojoGenericTypeModel
property, rawType, toString
-
-
-
-
Method Detail
-
array
public static <T> PojoGenericTypeModel<T[]> array(PojoRawTypeModel<? super T[]> rawTypeModel, PojoGenericTypeModel<T> elementType)
-
genericType
public static <T> PojoGenericTypeModel<T> genericType(PojoRawTypeModel<? super T> rawTypeModel, PojoGenericTypeModel<?> firstTypeArgument, PojoGenericTypeModel<?>... otherTypeArguments)
-
opaqueType
public static <T> PojoGenericTypeModel<T> opaqueType(PojoRawTypeModel<T> rawTypeModel)
-
name
public String name()
- Returns:
- A human-readable name for this type.
-
castTo
public <U> Optional<PojoTypeModel<? extends U>> castTo(Class<U> target)
- Type Parameters:
U
- The type to cast to.- Parameters:
target
- The type to cast to.- Returns:
- A new type model, representing the current type cast to the given type,
or
Optional.empty()
if casting is not supported. The type model will retain as much contextual type information as possible (type arguments, ...), so castingList<Integer>
toCollection
for example would returnCollection<Integer>
.
-
arrayElementType
public Optional<PojoGenericTypeModel<?>> arrayElementType()
- Specified by:
arrayElementType
in interfacePojoGenericTypeModel<T>
- Overrides:
arrayElementType
in classAbstractPojoGenericTypeModel<T>
- Returns:
- The model for the array element type, or an empty optional if the current type is not an array type. Implementations may decide to return a model of the raw array element type, or to retain generics information.
-
typeArgument
public Optional<? extends PojoGenericTypeModel<?>> typeArgument(Class<?> rawSuperType, int typeParameterIndex)
- Specified by:
typeArgument
in interfacePojoGenericTypeModel<T>
- Overrides:
typeArgument
in classAbstractPojoGenericTypeModel<T>
- Parameters:
rawSuperType
- The supertype to resolve type parameters fortypeParameterIndex
- The index of the type parameter to resolve- Returns:
- The model for the type argument for the type parameter defined in
rawSuperType
at indextypeParameterIndex
, or an empty optional if the current type does not extendrawSuperType
. Implementations may decide to return a model of the raw type argument, or to retain generics information.
-
-