nl.vpro.hibernate.search6.CollectionPropertyBridge Maven / Gradle / Ivy
package nl.vpro.hibernate.search6;
import java.util.Collection;
import org.hibernate.search.engine.backend.document.DocumentElement;
import org.hibernate.search.mapper.pojo.bridge.PropertyBridge;
import org.hibernate.search.mapper.pojo.bridge.runtime.PropertyBridgeWriteContext;
/**
* Wraps another bridge.
* @since 5.0
*/
public class CollectionPropertyBridge implements PropertyBridge {
private final PropertyBridge single;
public CollectionPropertyBridge(PropertyBridge single) {
this.single = single;
}
@Override
public void write(DocumentElement target, Collection bridgedElements, PropertyBridgeWriteContext context) {
if (bridgedElements != null) {
for (Object bridgedElement : bridgedElements) {
this.single.write(target, (T) bridgedElement, context);
}
}
}
}