public interface RoutingKeyBridge extends AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
bind(RoutingKeyBridgeBindingContext context)
Bind this bridge instance to the given context,
i.e.
|
default void |
close()
Close any resource before the bridge is discarded.
|
String |
toRoutingKey(String tenantIdentifier,
Object entityIdentifier,
PojoElement source,
RoutingKeyBridgeToRoutingKeyContext context)
Generate a routing key using the given
tenantIdentifier , entityIdentifier and PojoElement
as input and transforming them as necessary. |
void bind(RoutingKeyBridgeBindingContext context)
This method is called exactly once for each bridge instance, before any other method. It allows the bridge to:
RoutingKeyBridgeBindingContext.getBridgedElement()
.
toRoutingKey(String, Object, PojoElement, RoutingKeyBridgeToRoutingKeyContext)
method
using RoutingKeyBridgeBindingContext.getBridgedElement()
.
context
- An entry point allowing to perform the operations listed above.String toRoutingKey(String tenantIdentifier, Object entityIdentifier, PojoElement source, RoutingKeyBridgeToRoutingKeyContext context)
tenantIdentifier
, entityIdentifier
and PojoElement
as input and transforming them as necessary.
Reading from the PojoElement
should be done using
PojoModelElementAccessor
s retrieved when the
bind(RoutingKeyBridgeBindingContext)
method was called.
tenantIdentifier
- The tenant identifier currently in use (null
if none).entityIdentifier
- The value of the POJO property used to generate the document identifier,
i.e. the same value that was passed to IdentifierBridge.toDocumentIdentifier(Object, org.hibernate.search.mapper.pojo.bridge.runtime.IdentifierBridgeToDocumentIdentifierContext)
.source
- The PojoElement
to read from.context
- A context 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).default void close()
close
in interface AutoCloseable
Copyright © 2006-2018 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.