Interface TypeBridge<T>
- Type Parameters:
T
- The type on the POJO side of the bridge.
- All Superinterfaces:
AutoCloseable
A bridge between a POJO type and an element of the index schema.
The TypeBridge
interface is a more powerful version of ValueBridge
that applies to a whole type instead of a single property,
and can contribute more than one index field, in particular.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
close()
Close any resource before the bridge is discarded.void
write
(DocumentElement target, T bridgedElement, TypeBridgeWriteContext context) Write to fields in the givenDocumentElement
, using the givenbridgedElement
as input and transforming it as necessary.
-
Method Details
-
write
Write to fields in the givenDocumentElement
, using the givenbridgedElement
as input and transforming it as necessary.Writing to the
DocumentElement
should be done usingIndexFieldReference
s retrieved when the bridge wasbound
.Warning: Reading from
bridgedElement
should be done with care. Any read that was not declared duringbinding
(by declaring dependencies usingTypeBindingContext.dependencies()
or (advanced use) creating an accessor usingTypeBindingContext.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
- TheDocumentElement
to write to.bridgedElement
- The element this bridge is applied to, from which data should be read.context
- A context that can beextended
to 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:
close
in interfaceAutoCloseable
-