Class DslConverter<V,F>
java.lang.Object
org.hibernate.search.engine.backend.types.converter.spi.DslConverter<V,F>
- Type Parameters:
V- The type of values passed to the DSL.F- The type of converted values passed to the backend.
A converter for values passed to the DSL.
-
Constructor Summary
ConstructorsConstructorDescriptionDslConverter(Class<V> valueType, ToDocumentValueConverter<V, ? extends F> delegate) -
Method Summary
Modifier and TypeMethodDescriptionToDocumentValueConverter<V, ? extends F> delegate()booleanisCompatibleWith(DslConverter<?, ?> other) static <F> DslConverter<F, F> passThrough(Class<F> fieldAndValueType) toDocumentValue(V value, ToDocumentValueConvertContext context) toString()unknownTypeToDocumentValue(Object value, ToDocumentValueConvertContext context) Convert an input value of unknown type that may not have the required typeV.<T> DslConverter<? super T, F> withInputType(Class<T> inputTypeCandidate, org.hibernate.search.util.common.reporting.spi.EventContextProvider eventContextProvider) Check whether DSL arguments values can have the given type, and returns the DSL converter with an appropriate type.
-
Constructor Details
-
DslConverter
-
-
Method Details
-
passThrough
-
toString
-
valueType
-
toDocumentValue
- Parameters:
value- The source value to convert.context- A context that can beextendedto a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).- Returns:
- The converted index field value.
-
unknownTypeToDocumentValue
Convert an input value of unknown type that may not have the required typeV.Called when passing values to the predicate DSL in particular.
- Parameters:
value- The value to convert.context- A context that can beextendedto a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).- Returns:
- The converted index field value.
- Throws:
RuntimeException- If the value does not match the expected type.
-
withInputType
public <T> DslConverter<? super T,F> withInputType(Class<T> inputTypeCandidate, org.hibernate.search.util.common.reporting.spi.EventContextProvider eventContextProvider) Check whether DSL arguments values can have the given type, and returns the DSL converter with an appropriate type.- Type Parameters:
T- A candidate type for input values.- Parameters:
inputTypeCandidate- A candidate type for input values.eventContextProvider- A provider for the event context to pass to produced exceptions.- Returns:
- The DSL converter, guaranteed to accept values to the given type.
- Throws:
org.hibernate.search.util.common.SearchException- If the DSL converter cannot accept values to the given type.
-
isCompatibleWith
- Parameters:
other- AnotherDslConverter, nevernull.- Returns:
trueif the given object behaves exactly the same as this object, i.e. itstoDocumentValue(Object, ToDocumentValueConvertContext)andunknownTypeToDocumentValue(Object, ToDocumentValueConvertContext)methods are guaranteed to always return the same value as this object's when given the same input.falseotherwise, or when in doubt.
-
delegate
- Returns:
- The document value converter that is backing up this converter.
-