Package org.jboss.jandex

Examples of org.jboss.jandex.AnnotationValue


    return mappedBy;
  }

  private Set<CascadeType> determineCascadeTypes(AnnotationInstance associationAnnotation) {
    Set<CascadeType> cascadeTypes = new HashSet<CascadeType>();
    AnnotationValue cascadeValue = associationAnnotation.value( "cascade" );
    if ( cascadeValue != null ) {
      String[] cascades = cascadeValue.asEnumArray();
      for ( String s : cascades ) {
        cascadeTypes.add( Enum.valueOf( CascadeType.class, s ) );
      }
    }
    return cascadeTypes;
View Full Code Here


  }

  @Override
  protected Map<String, String> resolveHibernateTypeParameters(AnnotationInstance typeAnnotation) {
    HashMap<String, String> typeParameters = new HashMap<String, String>();
    AnnotationValue parameterAnnotationValue = typeAnnotation.value( "parameters" );
    if ( parameterAnnotationValue != null ) {
      AnnotationInstance[] parameterAnnotations = parameterAnnotationValue.asNestedArray();
      for ( AnnotationInstance parameterAnnotationInstance : parameterAnnotations ) {
        typeParameters.put(
            JandexHelper.getValue( parameterAnnotationInstance, "name", String.class ),
            JandexHelper.getValue( parameterAnnotationInstance, "value", String.class )
        );
View Full Code Here

          "Annotation parameters of type Class should be retrieved as strings (fully qualified class names)"
      );
    }

    // 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

    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

    );
    if ( hibernateProxyAnnotation != null ) {
      isLazy = hibernateProxyAnnotation.value( "lazy" ) == null
          || hibernateProxyAnnotation.value( "lazy" ).asBoolean();
      if ( isLazy ) {
        final AnnotationValue proxyClassValue = hibernateProxyAnnotation.value( "proxyClass" );
        if ( proxyClassValue == null ) {
          proxy = getName();
        }
        else {
          proxy = proxyClassValue.asString();
        }
      }
      else {
        proxy = null;
      }
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

        final EEApplicationClasses applicationClasses = deploymentUnit.getAttachment(Attachments.EE_APPLICATION_CLASSES_DESCRIPTION);
        final Module module = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.MODULE);
        final List<AnnotationInstance> resourceAnnotations = index.getAnnotations(RESOURCE_ANNOTATION_NAME);
        for (AnnotationInstance annotation : resourceAnnotations) {
            final AnnotationTarget annotationTarget = annotation.target();
            final AnnotationValue nameValue = annotation.value("name");
            final String name = nameValue != null ? nameValue.asString() : null;
            final AnnotationValue typeValue = annotation.value("type");
            final String type = typeValue != null ? typeValue.asClass().name().toString() : null;
            if (annotationTarget instanceof FieldInfo) {
                FieldInfo fieldInfo = (FieldInfo) annotationTarget;
                ClassInfo classInfo = fieldInfo.declaringClass();
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                processFieldResource(phaseContext, fieldInfo, name, type, classDescription, annotation, eeModuleDescription, module);
            } else if (annotationTarget instanceof MethodInfo) {
                MethodInfo methodInfo = (MethodInfo) annotationTarget;
                ClassInfo classInfo = methodInfo.declaringClass();
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                processMethodResource(phaseContext, methodInfo, name, type, classDescription, annotation, eeModuleDescription, module);
            } else if (annotationTarget instanceof ClassInfo) {
                ClassInfo classInfo = (ClassInfo) annotationTarget;
                EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                processClassResource(phaseContext, name, type, classDescription, annotation, eeModuleDescription, module);
            }
        }
        final List<AnnotationInstance> resourcesAnnotations = index.getAnnotations(RESOURCES_ANNOTATION_NAME);
        for (AnnotationInstance outerAnnotation : resourcesAnnotations) {
            final AnnotationTarget annotationTarget = outerAnnotation.target();
            if (annotationTarget instanceof ClassInfo) {
                final ClassInfo classInfo = (ClassInfo) annotationTarget;
                final AnnotationInstance[] values = outerAnnotation.value("value").asNestedArray();
                for (AnnotationInstance annotation : values) {
                    final AnnotationValue nameValue = annotation.value("name");
                    final String name = nameValue != null ? nameValue.asString() : null;
                    final AnnotationValue typeValue = annotation.value("type");
                    final String type = typeValue != null ? typeValue.asClass().name().toString() : null;
                    EEModuleClassDescription classDescription = applicationClasses.getOrAddClassByName(classInfo.name().toString());
                    processClassResource(phaseContext, name, type, classDescription, annotation, eeModuleDescription, module);
                }
            }
        }
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.