Package org.hibernate.search.bridge

Examples of org.hibernate.search.bridge.FieldBridge


  private void processEmbeddedNullValue(Document doc, EmbeddedTypeMetadata embeddedTypeMetadata, ConversionContext conversionContext) {
    final String nullMarker = embeddedTypeMetadata.getEmbeddedNullToken();
    if ( nullMarker != null ) {
      String fieldName = embeddedTypeMetadata.getEmbeddedNullFieldName();
      FieldBridge fieldBridge = embeddedTypeMetadata.getEmbeddedNullFieldBridge();
      final FieldBridge contextualizedBridge = conversionContext.oneWayConversionContext( fieldBridge );
      conversionContext.pushProperty( fieldName );
      try {
        contextualizedBridge.set( fieldName, null, doc, NULL_EMBEDDED_MARKER_OPTIONS );
      }
      finally {
        conversionContext.popProperty();
      }
    }
View Full Code Here


          value,
          conversionContext
      );
    }
    else {
      FieldBridge bridge = getBridge( getMetadata(), fieldName );
      if ( bridge != null ) {
        final Class<? extends FieldBridge> bridgeClass = bridge.getClass();
        if ( TwoWayFieldBridge.class.isAssignableFrom( bridgeClass ) ) {
          return objectToString( (TwoWayFieldBridge) bridge, fieldName, value, conversionContext );
        }
        else if ( StringBridge.class.isAssignableFrom( bridgeClass ) ) {
          return objectToString( (StringBridge) bridge, fieldName, value, conversionContext );
View Full Code Here

    if ( documentFieldMetadata != null && documentFieldMetadata.getFieldBridge() != null ) {
      return documentFieldMetadata.getFieldBridge();
    }

    // process embedded fields
    FieldBridge fieldBridge;

    for ( EmbeddedTypeMetadata embeddedTypeMetadata : typeMetadata.getEmbeddedTypeMetadata() ) {
      fieldBridge = getBridge( embeddedTypeMetadata, fieldName );
      if ( fieldBridge != null ) {
        return fieldBridge;
View Full Code Here

      allowFieldSelectionInProjection = false;
      return;
    }
    for ( PropertyMetadata propertyMetadata : getMetadata().getAllPropertyMetadata() ) {
      for ( DocumentFieldMetadata documentFieldMetadata : propertyMetadata.getFieldMetadata() ) {
        FieldBridge bridge = documentFieldMetadata.getFieldBridge();
        if ( !( bridge instanceof TwoWayStringBridge
            || bridge instanceof TwoWayString2FieldBridgeAdaptor
            || bridge instanceof NumericFieldBridge ) ) {
          allowFieldSelectionInProjection = false;
          return;
        }
      }
    }
    for ( DocumentFieldMetadata fieldMetadata : getMetadata().getClassBridgeMetadata() ) {
      FieldBridge bridge = fieldMetadata.getFieldBridge();
      if ( !( bridge instanceof TwoWayStringBridge
          || bridge instanceof TwoWayString2FieldBridgeAdaptor
          || bridge instanceof NumericFieldBridge ) ) {
        allowFieldSelectionInProjection = false;
        return;
View Full Code Here

  public BuiltinNumericIterableBridge(FieldBridge fieldBridge) {
    super( fieldBridge );
  }

  public BuiltinNumericIterableBridge() {
    super( new FieldBridge() {

      @Override
      public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
        if ( value == null ) {
          manageNull( name, document, luceneOptions );
View Full Code Here

  public BuiltinNumericMapBridge(FieldBridge fieldBridge) {
    super( fieldBridge );
  }

  public BuiltinNumericMapBridge() {
    super( new FieldBridge() {

      @Override
      public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
        if ( value == null ) {
          manageNull( name, document, luceneOptions );
View Full Code Here

  public BuiltinNumericArrayBridge(FieldBridge fieldBridge) {
    super( fieldBridge );
  }

  public BuiltinNumericArrayBridge() {
    super( new FieldBridge() {

      @Override
      public void set(String name, Object value, Document document, LuceneOptions luceneOptions) {
        if ( value == null ) {
          manageNull( name, document, luceneOptions );
View Full Code Here

   * @param clazz the {@code XClass} on which the annotation is defined on
   *
   * @return Returns the specified {@code FieldBridge} instance
   */
  public static FieldBridge extractType(ClassBridge cb, XClass clazz) {
    FieldBridge bridge = null;

    if ( cb != null ) {
      Class<?> impl = cb.impl();
      if ( impl != null ) {
        try {
View Full Code Here

    return bridge;
  }

  public static FieldBridge guessType(Field field, NumericField numericField, XMember member, ReflectionManager reflectionManager) {
    FieldBridge bridge;
    org.hibernate.search.annotations.FieldBridge bridgeAnn;
    //@Field bridge has priority over @FieldBridge
    if ( field != null && void.class != field.bridge().impl() ) {
      bridgeAnn = field.bridge();
    }
View Full Code Here

  private static FieldBridge doExtractType(
      org.hibernate.search.annotations.FieldBridge bridgeAnn,
      String appliedOnName,
      Class<?> appliedOnType) {
    assert bridgeAnn != null : "@FieldBridge instance cannot be null";
    FieldBridge bridge;
    Class impl = bridgeAnn.impl();
    if ( impl == void.class ) {
      throw new SearchException( "@FieldBridge with no implementation class defined in: " + appliedOnName );
    }
    try {
View Full Code Here

TOP

Related Classes of org.hibernate.search.bridge.FieldBridge

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.