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:
PojoTypeModel<T>
A synthetic implementation of
PojoTypeModel
,
i.e. one that is not bound to an actual Java type, but simulates one.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> PojoTypeModel<T[]>
array
(PojoRawTypeModel<? super T[]> rawTypeModel, PojoTypeModel<T> elementType) <U> Optional<PojoTypeModel<? extends U>>
boolean
static <T> PojoTypeModel<T>
genericType
(PojoRawTypeModel<? super T> rawTypeModel, PojoTypeModel<?> firstTypeArgument, PojoTypeModel<?>... otherTypeArguments) int
hashCode()
name()
static <T> PojoTypeModel<T>
opaqueType
(PojoRawTypeModel<T> rawTypeModel) Optional<? extends PojoTypeModel<?>>
typeArgument
(Class<?> rawSuperType, int typeParameterIndex) Methods inherited from class org.hibernate.search.mapper.pojo.model.spi.AbstractPojoGenericTypeModel
property, rawType, toString
-
Method Details
-
array
public static <T> PojoTypeModel<T[]> array(PojoRawTypeModel<? super T[]> rawTypeModel, PojoTypeModel<T> elementType) -
genericType
public static <T> PojoTypeModel<T> genericType(PojoRawTypeModel<? super T> rawTypeModel, PojoTypeModel<?> firstTypeArgument, PojoTypeModel<?>... otherTypeArguments) -
opaqueType
-
name
- Returns:
- A human-readable name for this type.
-
equals
- Specified by:
equals
in interfacePojoTypeModel<T>
- Overrides:
equals
in classObject
- Returns:
true
ifobj
is aPojoTypeModel
referencing the exact same type with the exact same exposed metadata.
-
hashCode
public int hashCode()- Specified by:
hashCode
in interfacePojoTypeModel<T>
- Overrides:
hashCode
in classObject
-
castTo
- 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
- 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 PojoTypeModel<?>> typeArgument(Class<?> rawSuperType, int typeParameterIndex) - 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.
-