Class ProjectionConverter<F,V>
- java.lang.Object
-
- org.hibernate.search.engine.backend.types.converter.spi.ProjectionConverter<F,V>
-
- Type Parameters:
F- The type of source values obtained from the backend.V- The type of projected values.
public final class ProjectionConverter<F,V> extends Object
A converter from a value obtained from the backend to a projected value.
-
-
Constructor Summary
Constructors Constructor Description ProjectionConverter(Class<V> valueType, FromDocumentValueConverter<? super F,V> delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VfromDocumentValue(F value, FromDocumentValueConvertContext context)booleanisCompatibleWith(ProjectionConverter<?,?> other)static <F> ProjectionConverter<F,F>passThrough(Class<F> fieldAndValueType)StringtoString()Class<V>valueType()<T> ProjectionConverter<F,? extends T>withConvertedType(Class<T> expectedType, EventContextProvider eventContextProvider)Check whether projected values can be assigned to the given type, and returns the projection converter with an appropriate type.
-
-
-
Constructor Detail
-
ProjectionConverter
public ProjectionConverter(Class<V> valueType, FromDocumentValueConverter<? super F,V> delegate)
-
-
Method Detail
-
passThrough
public static <F> ProjectionConverter<F,F> passThrough(Class<F> fieldAndValueType)
-
fromDocumentValue
public V fromDocumentValue(F value, FromDocumentValueConvertContext context)
- Parameters:
value- The index field value to convert.context- A context that can beextendedto a more useful type, giving access to such things as a Hibernate ORM Session (if using the Hibernate ORM mapper).- Returns:
- The converted value.
-
withConvertedType
public <T> ProjectionConverter<F,? extends T> withConvertedType(Class<T> expectedType, EventContextProvider eventContextProvider)
Check whether projected values can be assigned to the given type, and returns the projection converter with an appropriate type.- Type Parameters:
T- A candidate type for assignment of converted values.- Parameters:
expectedType- A candidate type for assignment of converted values.eventContextProvider- A provider for the event context to pass to produced exceptions.- Returns:
- The projection converter, guaranteed to convert values to the given type.
- Throws:
SearchException- If the projection converter cannot convert values to the given type.
-
isCompatibleWith
public boolean isCompatibleWith(ProjectionConverter<?,?> other)
- Parameters:
other- AnotherDslConverter, nevernull.- Returns:
trueif the given object behaves exactly the same as this object, i.e. itswithConvertedType(Class, EventContextProvider)andfromDocumentValue(Object, FromDocumentValueConvertContext)methods are guaranteed to always return the same value as this object's when given the same input.falseotherwise, or when in doubt.
-
-