Interface IdentifierBridge<I>
-
- Type Parameters:
I
- The type of identifiers on the POJO side of the bridge.
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
IdentifierBridgeRef.UndefinedBridgeImplementationType
public interface IdentifierBridge<I> extends AutoCloseable
A bridge between a POJO property of typeI
and a document identifier.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Close any resource before the bridge is discarded.I
fromDocumentIdentifier(String documentIdentifier, IdentifierBridgeFromDocumentIdentifierContext context)
Transform the given document identifier value back to the value of the POJO property.default boolean
isCompatibleWith(IdentifierBridge<?> other)
String
toDocumentIdentifier(I propertyValue, IdentifierBridgeToDocumentIdentifierContext context)
Transform the given POJO property value to the value of the document identifier.
-
-
-
Method Detail
-
toDocumentIdentifier
String toDocumentIdentifier(I propertyValue, IdentifierBridgeToDocumentIdentifierContext context)
Transform the given POJO property value to the value of the document identifier.Must return a unique value for each value of
propertyValue
- Parameters:
propertyValue
- The POJO property value to be transformed.context
- A context that can beextended
to 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
I fromDocumentIdentifier(String documentIdentifier, IdentifierBridgeFromDocumentIdentifierContext context)
Transform the given document identifier value back to the value of the POJO property.Must be the exact inverse function of
toDocumentIdentifier(Object, IdentifierBridgeToDocumentIdentifierContext)
, i.e.object.equals(fromDocumentIdentifier(toDocumentIdentifier(object, sessionContext)))
must always be true.- Parameters:
documentIdentifier
- The document identifier value to be transformed.context
- A sessionContext that can beextended
to 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.
-
isCompatibleWith
default boolean isCompatibleWith(IdentifierBridge<?> other)
-
close
default void close()
Close any resource before the bridge is discarded.- Specified by:
close
in interfaceAutoCloseable
-
-