public interface TypeBridge extends AutoCloseable
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.
Modifier and Type | Method and Description |
---|---|
void |
bind(TypeBridgeBindingContext context)
Bind this bridge instance to the given context,
i.e.
|
default void |
close()
Close any resource before the bridge is discarded.
|
void |
write(DocumentElement target,
PojoElement source,
TypeBridgeWriteContext context)
Write to fields in the given
DocumentElement ,
using the given PojoElement as input and transforming it as necessary. |
void bind(TypeBridgeBindingContext context)
This method is called exactly once for each bridge instance, before any other method. It allows the bridge to:
TypeBridgeBindingContext.getIndexSchemaElement()
.
TypeBridgeBindingContext.getBridgedElement()
.
write(DocumentElement, PojoElement, TypeBridgeWriteContext)
method
using TypeBridgeBindingContext.getBridgedElement()
.
context
- An entry point allowing to perform the operations listed above.void write(DocumentElement target, PojoElement source, TypeBridgeWriteContext context)
DocumentElement
,
using the given PojoElement
as input and transforming it as necessary.
Writing to the DocumentElement
should be done using
IndexFieldAccessor
s retrieved when the
bind(TypeBridgeBindingContext)
method was called.
Reading from the PojoElement
should be done using
PojoModelElementAccessor
s retrieved when the
bind(TypeBridgeBindingContext)
method was called.
target
- The DocumentElement
to write to.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.