Java 类org.hibernate.search.bridge.TwoWayFieldBridge 实例源码

项目:infinispan-avro    文件:ValueWrapperFieldBridge.java   
/**
 * @param bridge the {@link FieldBridge} used for each entry of the array
 */
public TwoWayArrayBridge(TwoWayFieldBridge bridge) {
   super(bridge);
   this.bridge = bridge;
}
项目:Hibernate-Search-GenericJPA    文件:ObjectHandlerTask.java   
@SuppressWarnings("unchecked")
private void index(Object entity, InstanceInitializer sessionInitializer, ConversionContext conversionContext)
        throws InterruptedException {
    Serializable id = (Serializable) this.peristenceUnitUtil.getIdentifier( entity );

    if ( entityIndexBinding == null ) {
        // it might be possible to receive not-indexes subclasses of the currently indexed columnTypes;
        // being not-indexed, we skip them.
        // FIXME for improved performance: avoid loading them in an early phase.
        return;
    }

    @SuppressWarnings("rawtypes")
    EntityIndexingInterceptor interceptor = this.entityIndexBinding.getEntityIndexingInterceptor();
    if ( interceptor != null ) {
        IndexingOverride onAdd = interceptor.onAdd( entity );
        switch ( onAdd ) {
            case REMOVE:
            case SKIP:
                return;
            default:
                break;
        }
        // default: continue indexing this instance
    }

    DocumentBuilderIndexedEntity docBuilder = this.entityIndexBinding.getDocumentBuilder();
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    conversionContext.pushProperty( docBuilder.getIdKeywordName() );
    String idInString = null;
    try {
        idInString = conversionContext.setClass( this.entityClass )
                .twoWayConversionContext( idBridge )
                .objectToString( id );
    }
    finally {
        conversionContext.popProperty();
    }
    // depending on the complexity of the object graph going to be indexed it's possible
    // that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork(
            null,
            this.entityClass,
            entity,
            id,
            idInString,
            sessionInitializer,
            conversionContext
    );
    this.batchBackend.enqueueAsyncWork( addWork );
}