Package org.jboss.jandex

Examples of org.jboss.jandex.AnnotationValue


    if ( type.isPrimitive() ) {
      type = PrimitiveWrapperHelper.getDescriptorByPrimitiveType( type ).getWrapperClass();
    }

    // try getting the untyped value from Jandex
    AnnotationValue annotationValue = annotation.value( element );

    try {
      if ( annotationValue != null ) {
        return explicitAnnotationParameter( annotationValue, type );
      }
View Full Code Here


    if ( type.isPrimitive() ) {
      type = PrimitiveWrapperHelper.getDescriptorByPrimitiveType( type ).getWrapperClass();
    }

    // try getting the untyped value from Jandex
    AnnotationValue annotationValue = annotation.value( element );

    try {
      if ( annotationValue != null ) {
        return explicitAnnotationParameter( annotationValue, type );
      }
View Full Code Here

   *
   * @see #getValue(AnnotationInstance, String, Class)
   */
  @SuppressWarnings("unchecked")
  public static <T extends Enum<T>> T getEnumValue(AnnotationInstance annotation, String element, Class<T> type) {
    AnnotationValue val = annotation.value( element );
    if ( val == null ) {
      return (T) getDefaultValue( annotation, element );
    }
    return Enum.valueOf( type, val.asEnum() );
  }
View Full Code Here

      this.child = child;
    }

    @Override
    public boolean process(AnnotationInstance annotationInstance) {
      AnnotationValue value = annotationInstance.value();
      AnnotationInstance[] indexedAttributeOverridesValues = value.asNestedArray();
      for ( AnnotationInstance ai : indexedAttributeOverridesValues ) {
        child.process( ai );
      }
      return true;
    }
View Full Code Here

    if ( annotationInstanceList == null || annotationInstanceList.isEmpty() ) {
      return;
    }
    List<AnnotationInstance> newAnnotationInstanceList = new ArrayList<AnnotationInstance>( annotationInstanceList.size() );
    for ( AnnotationInstance annotationInstance : annotationInstanceList ) {
      AnnotationValue cascadeValue = annotationInstance.value( "cascade" );
      List<AnnotationValue> newAnnotationValueList = new ArrayList<AnnotationValue>();
      newAnnotationValueList.addAll( annotationInstance.values() );
      if ( cascadeValue == null ) {
        AnnotationValue temp = AnnotationValue.createEnumValue( "", JPADotNames.CASCADE_TYPE, "PERSIST" );
        cascadeValue = AnnotationValue.createArrayValue( "cascade", new AnnotationValue[] { temp } );
      }
      else {
        newAnnotationValueList.remove( cascadeValue );
        String[] cascadeTypes = cascadeValue.asEnumArray();
View Full Code Here

      for ( AnnotationInstance ai : annotationInstances ) {
        pushIfNotExist( ai );
      }
    }
    else {
      AnnotationValue value = annotationInstance.value( "name" );
      String name = value.asString();
      isNotExist = ( annName.equals( TABLE_GENERATOR ) && !tableGeneratorMap.containsKey( name ) ) ||
          ( annName.equals( SEQUENCE_GENERATOR ) && !sequenceGeneratorMap.containsKey( name ) ) ||
          ( annName.equals( NAMED_QUERY ) && !namedQueryMap.containsKey( name ) ) ||
          ( annName.equals( NAMED_NATIVE_QUERY ) && !namedNativeQueryMap.containsKey( name ) ) ||
          ( annName.equals( SQL_RESULT_SET_MAPPING ) && !sqlResultSetMappingMap.containsKey( name ) );
View Full Code Here

    // if the column annotation is null we don't have to do anything. Everything is already defaulted.
    if ( columnAnnotation == null ) {
      return;
    }

    AnnotationValue nameValue = columnAnnotation.value( "name" );
    if ( nameValue != null ) {
      this.name = nameValue.asString();
    }

    AnnotationValue uniqueValue = columnAnnotation.value( "unique" );
    if ( uniqueValue != null ) {
      this.unique = nameValue.asBoolean();
    }

    AnnotationValue nullableValue = columnAnnotation.value( "nullable" );
    if ( nullableValue != null ) {
      this.nullable = nullableValue.asBoolean();
    }

    AnnotationValue insertableValue = columnAnnotation.value( "insertable" );
    if ( insertableValue != null ) {
      this.insertable = insertableValue.asBoolean();
    }

    AnnotationValue updatableValue = columnAnnotation.value( "updatable" );
    if ( updatableValue != null ) {
      this.updatable = updatableValue.asBoolean();
    }

    AnnotationValue columnDefinition = columnAnnotation.value( "columnDefinition" );
    if ( columnDefinition != null ) {
      this.columnDefinition = columnDefinition.asString();
    }

    AnnotationValue tableValue = columnAnnotation.value( "table" );
    if ( tableValue != null ) {
      this.table = tableValue.asString();
    }

    AnnotationValue lengthValue = columnAnnotation.value( "length" );
    if ( lengthValue != null ) {
      this.length = lengthValue.asInt();
    }

    AnnotationValue precisionValue = columnAnnotation.value( "precision" );
    if ( precisionValue != null ) {
      this.precision = precisionValue.asInt();
    }

    AnnotationValue scaleValue = columnAnnotation.value( "scale" );
    if ( scaleValue != null ) {
      this.scale = scaleValue.asInt();
    }
  }
View Full Code Here

  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

        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

    return secondaryTableSources;
  }


  private void createUniqueConstraints(AnnotationInstance tableAnnotation, String tableName) {
    AnnotationValue value = tableAnnotation.value( "uniqueConstraints" );
    if ( value == null ) {
      return;
    }

    AnnotationInstance[] uniqueConstraints = value.asNestedArray();
    for ( AnnotationInstance unique : uniqueConstraints ) {
      String name = unique.value( "name" ) == null ? null : unique.value( "name" ).asString();
      String[] columnNames = unique.value( "columnNames" ).asStringArray();
      UniqueConstraintSourceImpl uniqueConstraintSource =
          new UniqueConstraintSourceImpl(
View Full Code Here

TOP

Related Classes of org.jboss.jandex.AnnotationValue

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.