Examples of AnnotationDescriptor


Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    }

    private void createCalendarBridge(PropertyDescriptor property) {
      Map<String, Object> map = property.getCalendarBridge();
      for ( Map.Entry<String, Object> entry : map.entrySet() ) {
        AnnotationDescriptor calendarBrigeAnnotation = new AnnotationDescriptor( CalendarBridge.class );
        calendarBrigeAnnotation.setValue( entry.getKey(), entry.getValue() );
        annotations.put( CalendarBridge.class, AnnotationFactory.create( calendarBrigeAnnotation ) );
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    }

    private void createDocumentId(PropertyDescriptor property) {
      Map<String, Object> documentId = property.getDocumentId();
      if ( documentId != null ) {
        AnnotationDescriptor documentIdAnnotation = new AnnotationDescriptor( DocumentId.class );
        for ( Map.Entry<String, Object> entry : documentId.entrySet() ) {
          documentIdAnnotation.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( DocumentId.class, AnnotationFactory.create( documentIdAnnotation ) );
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    }

    private void createAnalyzerDiscriminator(PropertyDescriptor property) {
      Map<String, Object> analyzerDiscriminator = property.getAnalyzerDiscriminator();
      if ( analyzerDiscriminator != null ) {
        AnnotationDescriptor analyzerDiscriminatorAnn = new AnnotationDescriptor( AnalyzerDiscriminator.class );
        for ( Map.Entry<String, Object> entry : analyzerDiscriminator.entrySet() ) {
          analyzerDiscriminatorAnn.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( AnalyzerDiscriminator.class, AnnotationFactory.create( analyzerDiscriminatorAnn ) );
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

      final Collection<Map<String,Object>> numericFields = property.getNumericFields();
      List<org.hibernate.search.annotations.Field> fieldAnnotations =
          new ArrayList<org.hibernate.search.annotations.Field>( fields.size() );
      List<NumericField> numericFieldAnnotations = new ArrayList<NumericField>( numericFields.size() );
      for(Map<String, Object> numericField : numericFields) {
        AnnotationDescriptor fieldAnnotation = new AnnotationDescriptor( NumericField.class );
        for ( Map.Entry<String, Object> entry : numericField.entrySet() ) {
          fieldAnnotation.setValue( entry.getKey(), entry.getValue() );
        }
        numericFieldAnnotations.add( (NumericField) AnnotationFactory.create( fieldAnnotation ) );
      }
      for(Map<String, Object> field : fields) {
        AnnotationDescriptor fieldAnnotation = new AnnotationDescriptor( org.hibernate.search.annotations.Field.class );
        for ( Map.Entry<String, Object> entry : field.entrySet() ) {
          if ( entry.getKey().equals( "analyzer" ) ) {
            AnnotationDescriptor analyzerAnnotation = new AnnotationDescriptor( Analyzer.class );
            @SuppressWarnings("unchecked")
            Map<String, Object> analyzer = (Map<String, Object>) entry.getValue();
            for ( Map.Entry<String, Object> analyzerEntry : analyzer.entrySet() ) {
              analyzerAnnotation.setValue( analyzerEntry.getKey(), analyzerEntry.getValue() );
            }
            fieldAnnotation.setValue( "analyzer", AnnotationFactory.create( analyzerAnnotation ) );
          }
          else if ( entry.getKey().equals( "boost" ) ) {
            AnnotationDescriptor boostAnnotation = new AnnotationDescriptor( Boost.class );
            @SuppressWarnings("unchecked")
            Map<String, Object> boost = (Map<String, Object>) entry.getValue();
            for ( Map.Entry<String, Object> boostEntry : boost.entrySet() ) {
              boostAnnotation.setValue( boostEntry.getKey(), boostEntry.getValue() );
            }
            fieldAnnotation.setValue( "boost", AnnotationFactory.create( boostAnnotation ) );
          }
          else if ( entry.getKey().equals( "bridge" ) ) {
            AnnotationDescriptor bridgeAnnotation = new AnnotationDescriptor( FieldBridge.class );
            @SuppressWarnings("unchecked")
            Map<String, Object> bridge = (Map<String, Object>) entry.getValue();
            for ( Map.Entry<String, Object> bridgeEntry : bridge.entrySet() ) {
              if ( bridgeEntry.getKey().equals( "params" ) ) {
                addParamsToAnnotation( bridgeAnnotation, bridgeEntry );
              }
              else {
                bridgeAnnotation.setValue( bridgeEntry.getKey(), bridgeEntry.getValue() );
              }
            }
            fieldAnnotation.setValue( "bridge", AnnotationFactory.create( bridgeAnnotation ) );
          }
          else {
            fieldAnnotation.setValue( entry.getKey(), entry.getValue() );
          }
        }
        fieldAnnotations.add( (org.hibernate.search.annotations.Field) AnnotationFactory.create( fieldAnnotation ) );
      }
      AnnotationDescriptor fieldsAnnotation = new AnnotationDescriptor( Fields.class );
      AnnotationDescriptor numericFieldsAnnotation = new AnnotationDescriptor( NumericFields.class );

      final org.hibernate.search.annotations.Field[] fieldArray =
          new org.hibernate.search.annotations.Field[fieldAnnotations.size()];
      final org.hibernate.search.annotations.Field[] fieldAsArray = fieldAnnotations.toArray( fieldArray );

      final NumericField[] numericFieldArray = new NumericField[numericFieldAnnotations.size()];
      final NumericField[] numericFieldAsArray = numericFieldAnnotations.toArray( numericFieldArray );
      numericFieldsAnnotation.setValue( "value", numericFieldAsArray);
      annotations.put( NumericFields.class, AnnotationFactory.create( numericFieldsAnnotation ));
      fieldsAnnotation.setValue( "value", fieldAsArray );
      annotations.put( Fields.class, AnnotationFactory.create( fieldsAnnotation ) );
      createDateBridge( property );
      createCalendarBridge( property );
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    }

    private void createDynamicBoost(PropertyDescriptor property) {
      if ( property.getDynamicBoost() != null ) {
        AnnotationDescriptor dynamicBoostAnn = new AnnotationDescriptor( DynamicBoost.class );
        Set<Entry<String, Object>> entrySet = property.getDynamicBoost().entrySet();
        for ( Entry<String, Object> entry : entrySet ) {
          dynamicBoostAnn.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( DynamicBoost.class, AnnotationFactory.create( dynamicBoostAnn ) );
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    }

    private void createContainedIn(PropertyDescriptor property) {
      if ( property.getContainedIn() != null ) {
        Map<String, Object> containedIn = property.getContainedIn();
        AnnotationDescriptor containedInAnn = new AnnotationDescriptor( ContainedIn.class );
        Set<Entry<String, Object>> entrySet = containedIn.entrySet();
        for ( Entry<String, Object> entry : entrySet ) {
          containedInAnn.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( ContainedIn.class, AnnotationFactory.create( containedInAnn ) );
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

    }

    private void createIndexEmbedded(PropertyDescriptor property) {
      Map<String, Object> indexEmbedded = property.getIndexEmbedded();
      if ( indexEmbedded != null ) {
        AnnotationDescriptor indexEmbeddedAnn = new AnnotationDescriptor( IndexedEmbedded.class );
        Set<Entry<String, Object>> entrySet = indexEmbedded.entrySet();
        for ( Entry<String, Object> entry : entrySet ) {
          indexEmbeddedAnn.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( IndexedEmbedded.class, AnnotationFactory.create( indexEmbeddedAnn ) );
      }
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

      }
    }

    private void createIndexed(EntityDescriptor entity) {
      Class<? extends Annotation> annotationType = Indexed.class;
      AnnotationDescriptor annotation = new AnnotationDescriptor( annotationType );
      if ( entity.getIndexed() != null ) {
        for ( Map.Entry<String, Object> entry : entity.getIndexed().entrySet() ) {
          annotation.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( annotationType, AnnotationFactory.create( annotation ) );
      }

      if ( entity.getSimilarity() != null ) {
        annotation = new AnnotationDescriptor( Similarity.class );
        for ( Map.Entry<String, Object> entry : entity.getSimilarity().entrySet() ) {
          annotation.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( Similarity.class, AnnotationFactory.create( annotation ) );
      }

      if ( entity.getBoost() != null ) {
        annotation = new AnnotationDescriptor( Boost.class );
        for ( Map.Entry<String, Object> entry : entity.getBoost().entrySet() ) {
          annotation.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( Boost.class, AnnotationFactory.create( annotation ) );
      }

      if ( entity.getAnalyzerDiscriminator() != null ) {
        annotation = new AnnotationDescriptor( AnalyzerDiscriminator.class );
        for ( Map.Entry<String, Object> entry : entity.getAnalyzerDiscriminator().entrySet() ) {
          annotation.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( AnalyzerDiscriminator.class, AnnotationFactory.create( annotation ) );
      }
      if ( entity.getFullTextFilterDefs().size() > 0 ) {
        AnnotationDescriptor fullTextFilterDefsAnnotation = new AnnotationDescriptor( FullTextFilterDefs.class );
        FullTextFilterDef[] fullTextFilterDefArray = createFullTextFilterDefArray( entity.getFullTextFilterDefs() );
        fullTextFilterDefsAnnotation.setValue( "value", fullTextFilterDefArray );
        annotations.put( FullTextFilterDefs.class, AnnotationFactory.create( fullTextFilterDefsAnnotation ) );
      }
      if ( entity.getProvidedId() != null ) {
        createProvidedId( entity );
      }

      if ( entity.getClassBridgeDefs().size() > 0 ) {
        AnnotationDescriptor classBridgesAnn = new AnnotationDescriptor( ClassBridges.class );
        ClassBridge[] classBridesDefArray = createClassBridgesDefArray( entity.getClassBridgeDefs() );
        classBridgesAnn.setValue( "value", classBridesDefArray );
        annotations.put( ClassBridges.class, AnnotationFactory.create( classBridgesAnn ) );
      }

      if ( entity.getDynamicBoost() != null ) {
        AnnotationDescriptor dynamicBoostAnn = new AnnotationDescriptor( DynamicBoost.class );
        Set<Entry<String, Object>> entrySet = entity.getDynamicBoost().entrySet();
        for ( Entry<String, Object> entry : entrySet ) {
          dynamicBoostAnn.setValue( entry.getKey(), entry.getValue() );
        }
        annotations.put( DynamicBoost.class, AnnotationFactory.create( dynamicBoostAnn ) );
      }

    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

      return classBridgeDefArray;
    }


    private ClassBridge createClassBridge(Map<String, Object> classBridgeDef) {
      AnnotationDescriptor annotation = new AnnotationDescriptor( ClassBridge.class );
      Set<Entry<String, Object>> entrySet = classBridgeDef.entrySet();
      for ( Entry<String, Object> entry : entrySet ) {
        if ( entry.getKey().equals( "params" ) ) {
          addParamsToAnnotation( annotation, entry );
        }
        else {
          annotation.setValue( entry.getKey(), entry.getValue() );
        }
      }
      return AnnotationFactory.create( annotation );
    }
View Full Code Here

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor

      }
      return AnnotationFactory.create( annotation );
    }

    private void createProvidedId(EntityDescriptor entity) {
      AnnotationDescriptor annotation = new AnnotationDescriptor( ProvidedId.class );
      Set<Entry<String, Object>> entrySet = entity.getProvidedId().entrySet();
      for ( Entry<String, Object> entry : entrySet ) {
        if ( entry.getKey().equals( "bridge" ) ) {
          AnnotationDescriptor bridgeAnnotation = new AnnotationDescriptor( FieldBridge.class );
          @SuppressWarnings("unchecked")
          Map<String, Object> bridge = (Map<String, Object>) entry.getValue();
          for ( Map.Entry<String, Object> bridgeEntry : bridge.entrySet() ) {
            if ( bridgeEntry.getKey().equals( "params" ) ) {
              addParamsToAnnotation( bridgeAnnotation, bridgeEntry );
            }
            else {
              bridgeAnnotation.setValue( bridgeEntry.getKey(), bridgeEntry.getValue() );
            }
          }
          annotation.setValue( "bridge", AnnotationFactory.create( bridgeAnnotation ) );
        }
        else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.