public interface IdentifierBridge<I> extends AutoCloseable
I
and a document identifier.Modifier and Type | Method and Description |
---|---|
default void |
bind(IdentifierBridgeBindingContext<I> context)
Bind this bridge instance to the given context,
i.e.
|
I |
cast(Object value)
Cast an input value to the expected type
I . |
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.
|
default void bind(IdentifierBridgeBindingContext<I> context)
This method is called exactly once for each bridge instance, before any other method. It allows the bridge to inspect the type of values extracted from the POJO model that will be passed to this bridge.
context
- An entry point to perform the operations listed above.String toDocumentIdentifier(I propertyValue, IdentifierBridgeToDocumentIdentifierContext context)
Must return a unique value for each value of propertyValue
propertyValue
- The POJO property value to be transformed.context
- A context that can be
extended
to a more useful type, giving access to such things as a Hibernate ORM SessionFactory (if using the Hibernate ORM mapper).I fromDocumentIdentifier(String documentIdentifier, IdentifierBridgeFromDocumentIdentifierContext context)
Must be the exact inverse function of toDocumentIdentifier(Object, IdentifierBridgeToDocumentIdentifierContext)
,
i.e. object.equals(fromDocumentIdentifier(toDocumentIdentifier(object, sessionContext)))
must always be true.
documentIdentifier
- The document identifier value to be transformed.context
- A sessionContext that can be
extended
to a more useful type, giving access to such things as a Hibernate ORM Session (if using the Hibernate ORM mapper).I cast(Object value)
I
.
Called for values passed to the predicate DSL in particular.
value
- The value to convert.RuntimeException
- If the value does not match the expected type.default boolean isCompatibleWith(IdentifierBridge<?> other)
default void close()
close
in interface AutoCloseable
Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.