Class DefaultEnumBridge<T extends Enum<T>>
- java.lang.Object
-
- org.hibernate.search.mapper.pojo.bridge.builtin.impl.DefaultEnumBridge<T>
-
- All Implemented Interfaces:
AutoCloseable,IdentifierBridge<T>,ValueBridge<T,String>
public final class DefaultEnumBridge<T extends Enum<T>> extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultEnumBridge.Binder
-
Constructor Summary
Constructors Constructor Description DefaultEnumBridge(Class<T> enumType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close any resource before the bridge is discarded.VfromDocumentIdentifier(String documentIdentifier, IdentifierBridgeFromDocumentIdentifierContext context)Transform the given document identifier value back to the value of the POJO property.VfromIndexedValue(String value, ValueBridgeFromIndexedValueContext context)Transform the given indexed field value to the corresponding POJO-extracted value.protected TfromString(String value)booleanisCompatibleWith(IdentifierBridge<?> other)booleanisCompatibleWith(ValueBridge<?,?> other)Stringparse(String value)Parse an input String to the raw index field value.StringtoDocumentIdentifier(V propertyValue, IdentifierBridgeToDocumentIdentifierContext context)Transform the given POJO property value to the value of the document identifier.StringtoIndexedValue(V value, ValueBridgeToIndexedValueContext context)Transform the given POJO-extracted value into the value of the indexed field.StringtoString()protected StringtoString(T value)
-
-
-
Method Detail
-
toString
public String toString()
-
isCompatibleWith
public boolean isCompatibleWith(IdentifierBridge<?> other)
- Specified by:
isCompatibleWithin interfaceIdentifierBridge<T extends Enum<T>>
-
isCompatibleWith
public boolean isCompatibleWith(ValueBridge<?,?> other)
- Specified by:
isCompatibleWithin interfaceValueBridge<T extends Enum<T>,String>- Parameters:
other- AnotherValueBridge, nevernull.- Returns:
trueif the given object is also aValueBridgethat behaves exactly the same as this object, i.e. itsValueBridge.toIndexedValue(Object, ValueBridgeToIndexedValueContext)method is guaranteed to accept the same values as this object's and to always return the same value as this object's when given the same input.falseotherwise, or when in doubt.
-
toIndexedValue
public final String toIndexedValue(V value, ValueBridgeToIndexedValueContext context)
Description copied from interface:ValueBridgeTransform the given POJO-extracted value into the value of the indexed field.- Parameters:
value- The POJO-extracted value to be transformed.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 value of the indexed field.
-
fromIndexedValue
public final V fromIndexedValue(String value, ValueBridgeFromIndexedValueContext context)
Description copied from interface:ValueBridgeTransform the given indexed field value to the corresponding POJO-extracted value.- Parameters:
value- The value of the indexed field to be transformed.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 POJO-extracted value.
-
parse
public final String parse(String value)
Description copied from interface:ValueBridgeParse an input String to the raw index field value.- Parameters:
value- The value to parse.- Returns:
- The raw index field value.
-
close
public final void close()
Description copied from interface:ValueBridgeClose any resource before the bridge is discarded.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIdentifierBridge<V>- Specified by:
closein interfaceValueBridge<V,F>
-
toDocumentIdentifier
public final String toDocumentIdentifier(V propertyValue, IdentifierBridgeToDocumentIdentifierContext context)
Description copied from interface:IdentifierBridgeTransform the given POJO property value to the value of the document identifier.Must return a unique value for each value of
propertyValue- Specified by:
toDocumentIdentifierin interfaceIdentifierBridge<V>- Parameters:
propertyValue- The POJO property value to be transformed.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 value of the document identifier.
-
fromDocumentIdentifier
public final V fromDocumentIdentifier(String documentIdentifier, IdentifierBridgeFromDocumentIdentifierContext context)
Description copied from interface:IdentifierBridgeTransform the given document identifier value back to the value of the POJO property.Must be the exact inverse function of
IdentifierBridge.toDocumentIdentifier(Object, IdentifierBridgeToDocumentIdentifierContext), i.e.object.equals(fromDocumentIdentifier(toDocumentIdentifier(object, sessionContext)))must always be true.- Specified by:
fromDocumentIdentifierin interfaceIdentifierBridge<V>- Parameters:
documentIdentifier- The document identifier value to be transformed.context- A sessionContext 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 value of the document identifier.
-
-