Interface PropertyBridge<P>
- Type Parameters:
P- The type of the property on the POJO side of the bridge.
- All Superinterfaces:
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.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()Close any resource before the bridge is discarded.voidwrite(DocumentElement target, P bridgedElement, PropertyBridgeWriteContext context) Write to fields in the givenDocumentElement, using the givenbridgedElementas input and transforming it as necessary.
-
Method Details
-
write
Write to fields in the givenDocumentElement, using the givenbridgedElementas input and transforming it as necessary.Writing to the
DocumentElementshould be done usingIndexFieldReferences retrieved when the bridge wasbound.Warning: Reading from
bridgedElementshould be done with care. Any read that was not declared duringbinding(by declaring dependencies usingPropertyBindingContext.dependencies()or (advanced use) creating an accessor usingPropertyBindingContext.bridgedElement()) 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.- Parameters:
target- TheDocumentElementto write to.bridgedElement- The element this bridge is applied to, from which data should be read.context- A context that can beextendedto a more useful type, giving access to such things as a Hibernate ORM Session (if using the Hibernate ORM mapper).
-
close
default void close()Close any resource before the bridge is discarded.- Specified by:
closein interfaceAutoCloseable
-