Examples of AnnotationInstance


Examples of org.jboss.jandex.AnnotationInstance

    this.embeddedAttributeName = embeddedAttributeName;
    this.parentReferencingAttributeName = checkParentAnnotation();
  }

  private String checkParentAnnotation() {
    AnnotationInstance parentAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(),
        HibernateDotNames.PARENT
    );
    if ( parentAnnotation == null ) {
      return null;
    }
    else {
      return JandexHelper.getPropertyName( parentAnnotation.target() );
    }
  }
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

           String accessType,
           Map<DotName, List<AnnotationInstance>> annotations,
           EntityBindingContext context) {
    super( name, attributeType, accessType, annotations, context );

    AnnotationInstance versionAnnotation = JandexHelper.getSingleAnnotation( annotations, JPADotNames.VERSION );
    isVersioned = versionAnnotation != null;

    if ( isId() ) {
      // an id must be unique and cannot be nullable
      getColumnValues().setUnique( true );
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

    sb.append( "{name=" ).append( getName() );
    return sb.toString();
  }

  private void checkBasicAnnotation() {
    AnnotationInstance basicAnnotation = JandexHelper.getSingleAnnotation( annotations(), JPADotNames.BASIC );
    if ( basicAnnotation != null ) {
      FetchType fetchType = FetchType.LAZY;
      AnnotationValue fetchValue = basicAnnotation.value( "fetch" );
      if ( fetchValue != null ) {
        fetchType = Enum.valueOf( FetchType.class, fetchValue.asEnum() );
      }
      this.isLazy = fetchType == FetchType.LAZY;

      AnnotationValue optionalValue = basicAnnotation.value( "optional" );
      if ( optionalValue != null ) {
        this.isOptional = optionalValue.asBoolean();
      }
    }
  }
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

    }
  }

  // TODO - there is more todo for updatable and insertable. Checking the @Generated annotation is only one part (HF)
  private void checkGeneratedAnnotation() {
    AnnotationInstance generatedAnnotation = JandexHelper.getSingleAnnotation(
        annotations(),
        HibernateDotNames.GENERATED
    );
    if ( generatedAnnotation != null ) {
      this.isInsertable = false;

      AnnotationValue generationTimeValue = generatedAnnotation.value();
      if ( generationTimeValue != null ) {
        GenerationTime genTime = Enum.valueOf( GenerationTime.class, generationTimeValue.asEnum() );
        if ( GenerationTime.ALWAYS.equals( genTime ) ) {
          this.isUpdatable = false;
          this.propertyGeneration = PropertyGeneration.parse( genTime.toString().toLowerCase() );
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

  private List<AnnotationInstance> getAllColumnTransformerAnnotations() {
    List<AnnotationInstance> allColumnTransformerAnnotations = new ArrayList<AnnotationInstance>();

    // not quite sure about the usefulness of @ColumnTransformers (HF)
    AnnotationInstance columnTransformersAnnotations = JandexHelper.getSingleAnnotation(
        annotations(),
        HibernateDotNames.COLUMN_TRANSFORMERS
    );
    if ( columnTransformersAnnotations != null ) {
      AnnotationInstance[] annotationInstances = allColumnTransformerAnnotations.get( 0 ).value().asNestedArray();
      allColumnTransformerAnnotations.addAll( Arrays.asList( annotationInstances ) );
    }

    AnnotationInstance columnTransformerAnnotation = JandexHelper.getSingleAnnotation(
        annotations(),
        HibernateDotNames.COLUMN_TRANSFORMER
    );
    if ( columnTransformerAnnotation != null ) {
      allColumnTransformerAnnotations.add( columnTransformerAnnotation );
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

    return readWrite;
  }

  private String parseCheckAnnotation() {
    String checkCondition = null;
    AnnotationInstance checkAnnotation = JandexHelper.getSingleAnnotation( annotations(), HibernateDotNames.CHECK );
    if ( checkAnnotation != null ) {
      checkCondition = checkAnnotation.value( "constraints" ).toString();
    }
    return checkCondition;
  }
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

    return checkCondition;
  }

  private IdGenerator checkGeneratedValueAnnotation() {
    IdGenerator generator = null;
    AnnotationInstance generatedValueAnnotation = JandexHelper.getSingleAnnotation(
        annotations(),
        JPADotNames.GENERATED_VALUE
    );
    if ( generatedValueAnnotation != null ) {
      String name = JandexHelper.getValue( generatedValueAnnotation, "generator", String.class );
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

    boolean hasOwnTable = definesItsOwnTable();
    this.explicitEntityName = determineExplicitEntityName();
    this.constraintSources = new HashSet<ConstraintSource>();

    if ( hasOwnTable ) {
      AnnotationInstance tableAnnotation = JandexHelper.getSingleAnnotation(
          getClassInfo(),
          JPADotNames.TABLE
      );
      this.primaryTableSource = createTableSource( tableAnnotation );
    }
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

  public List<JpaCallbackClass> getJpaCallbacks() {
    return jpaCallbacks;
  }

  private String determineExplicitEntityName() {
    final AnnotationInstance jpaEntityAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), JPADotNames.ENTITY
    );
    return JandexHelper.getValue( jpaEntityAnnotation, "name", String.class );
  }
View Full Code Here

Examples of org.jboss.jandex.AnnotationInstance

  private void processDiscriminator() {
    if ( !InheritanceType.SINGLE_TABLE.equals( inheritanceType ) ) {
      return;
    }

    final AnnotationInstance discriminatorValueAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), JPADotNames.DISCRIMINATOR_VALUE
    );
    if ( discriminatorValueAnnotation != null ) {
      this.discriminatorMatchValue = discriminatorValueAnnotation.value().asString();
    }

    final AnnotationInstance discriminatorColumnAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), JPADotNames.DISCRIMINATOR_COLUMN
    );

    final AnnotationInstance discriminatorFormulaAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(),
        HibernateDotNames.DISCRIMINATOR_FORMULA
    );


    Class<?> type = String.class; // string is the discriminator default
    if ( discriminatorFormulaAnnotation != null ) {
      String expression = JandexHelper.getValue( discriminatorFormulaAnnotation, "value", String.class );
      discriminatorFormula = new FormulaValue( getPrimaryTableSource().getExplicitTableName(), expression );
    }
    discriminatorColumnValues = new ColumnValues( null ); //(stliu) give null here, will populate values below
    discriminatorColumnValues.setNullable( false ); // discriminator column cannot be null
    if ( discriminatorColumnAnnotation != null ) {

      DiscriminatorType discriminatorType = Enum.valueOf(
          DiscriminatorType.class, discriminatorColumnAnnotation.value( "discriminatorType" ).asEnum()
      );
      switch ( discriminatorType ) {
        case STRING: {
          type = String.class;
          break;
        }
        case CHAR: {
          type = Character.class;
          break;
        }
        case INTEGER: {
          type = Integer.class;
          break;
        }
        default: {
          throw new AnnotationException( "Unsupported discriminator type: " + discriminatorType );
        }
      }

      discriminatorColumnValues.setName(
          JandexHelper.getValue(
              discriminatorColumnAnnotation,
              "name",
              String.class
          )
      );
      discriminatorColumnValues.setLength(
          JandexHelper.getValue(
              discriminatorColumnAnnotation,
              "length",
              Integer.class
          )
      );
      discriminatorColumnValues.setColumnDefinition(
          JandexHelper.getValue(
              discriminatorColumnAnnotation,
              "columnDefinition",
              String.class
          )
      );
    }
    discriminatorType = type;

    AnnotationInstance discriminatorOptionsAnnotation = JandexHelper.getSingleAnnotation(
        getClassInfo(), HibernateDotNames.DISCRIMINATOR_OPTIONS
    );
    if ( discriminatorOptionsAnnotation != null ) {
      isDiscriminatorForced = discriminatorOptionsAnnotation.value( "force" ).asBoolean();
      isDiscriminatorIncludedInSql = discriminatorOptionsAnnotation.value( "insert" ).asBoolean();
    }
    else {
      isDiscriminatorForced = false;
      isDiscriminatorIncludedInSql = true;
    }
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.