public interface PropertyBridge extends AutoCloseable
The PropertyBridge interface is a more powerful version of ValueBridge
that can use reflection to get information about the property being bridged,
and can contribute more than one index field, in particular.
| Modifier and Type | Method and Description |
|---|---|
default void |
close()
Close any resource before the bridge is discarded.
|
void |
write(DocumentElement target,
Object bridgedElement,
PropertyBridgeWriteContext context)
Write to fields in the given
DocumentElement,
using the given bridgedElement as input and transforming it as necessary. |
void write(DocumentElement target, Object bridgedElement, PropertyBridgeWriteContext context)
DocumentElement,
using the given bridgedElement as input and transforming it as necessary.
Writing to the DocumentElement should be done using
IndexFieldReferences retrieved
when the bridge was bound.
Warning: Reading from bridgedElement should be done with care.
Any read that was not declared during binding
(by declaring dependencies using PropertyBindingContext.getDependencies()
or (advanced use) creating an accessor using PropertyBindingContext.getBridgedElement())
may lead to out-of-sync indexes,
because Hibernate Search will consider the read property irrelevant to indexing
and will not reindex entities when that property changes.
target - The DocumentElement to write to.bridgedElement - The element this bridge is applied to, from which data should be read.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 AutoCloseableCopyright © 2006-2020 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.