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 |
---|---|
void |
bind(PropertyBridgeBindingContext 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,
PropertyBridgeWriteContext context)
Write to fields in the given
DocumentElement ,
using the given PojoElement as input and transforming it as necessary. |
void bind(PropertyBridgeBindingContext context)
This method is called exactly once for each bridge instance, before any other method. It allows the bridge to:
PropertyBridgeBindingContext.getIndexSchemaElement()
.
PropertyBridgeBindingContext.getBridgedElement()
.
write(DocumentElement, PojoElement, PropertyBridgeWriteContext)
method
using PropertyBridgeBindingContext.getBridgedElement()
.
context
- An entry point allowing to perform the operations listed above.void write(DocumentElement target, PojoElement source, PropertyBridgeWriteContext 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(PropertyBridgeBindingContext)
method was called.
Reading from the PojoElement
should be done using
PojoModelElementAccessor
s retrieved when the
bind(PropertyBridgeBindingContext)
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.