Package org.jboss.jandex

Examples of org.jboss.jandex.AnnotationInstance


    if ( info == null ) {
      return false;
    }

    // we are only interested in building the class hierarchies for @Entity
    AnnotationInstance jpaEntityAnnotation = JandexHelper.getSingleAnnotation( info, JPADotNames.ENTITY );
    if ( jpaEntityAnnotation == null ) {
      return false;
    }

    // some sanity checks
    AnnotationInstance mappedSuperClassAnnotation = JandexHelper.getSingleAnnotation(
        info, JPADotNames.MAPPED_SUPERCLASS
    );
    String className = info.toString();
    assertNotEntityAndMappedSuperClass( jpaEntityAnnotation, mappedSuperClassAnnotation, className );

    AnnotationInstance embeddableAnnotation = JandexHelper.getSingleAnnotation(
        info, JPADotNames.EMBEDDABLE
    );
    assertNotEntityAndEmbeddable( jpaEntityAnnotation, embeddableAnnotation, className );

    return true;
View Full Code Here


    if ( info == null ) {
      return false;
    }

    // we are only interested in building the class hierarchies for @Entity
    AnnotationInstance mappedSuperclassAnnotation = JandexHelper.getSingleAnnotation(
        info,
        JPADotNames.MAPPED_SUPERCLASS
    );
    return mappedSuperclassAnnotation != null;
  }
View Full Code Here

      return InheritanceType.NO_INHERITANCE;
    }

    // if we have more than one entity class the default is SINGLE_TABLE
    InheritanceType inheritanceType = InheritanceType.SINGLE_TABLE;
    AnnotationInstance inheritanceAnnotation = JandexHelper.getSingleAnnotation(
        rootClassInfo, JPADotNames.INHERITANCE
    );
    if ( inheritanceAnnotation != null ) {
      String enumName = inheritanceAnnotation.value( "strategy" ).asEnum();
      javax.persistence.InheritanceType jpaInheritanceType = Enum.valueOf(
          javax.persistence.InheritanceType.class, enumName
      );
      inheritanceType = InheritanceType.get( jpaInheritanceType );
    }
View Full Code Here

  private AccessType determineClassAccessType(AccessType defaultAccessType) {
    // default to the hierarchy access type to start with
    AccessType accessType = defaultAccessType;

    AnnotationInstance accessAnnotation = JandexHelper.getSingleAnnotation( classInfo, JPADotNames.ACCESS );
    if ( accessAnnotation != null && accessAnnotation.target().getClass().equals( ClassInfo.class ) ) {
      accessType = JandexHelper.getEnumValue( accessAnnotation, "value", AccessType.class );
    }

    return accessType;
  }
View Full Code Here

      }
      case EMBEDDED_ID: {
        throw new NotYetImplementedException( "Embedded ids must still be implemented." );
      }
      case EMBEDDED: {
        AnnotationInstance targetAnnotation = JandexHelper.getSingleAnnotation(
            getClassInfo(),
            HibernateDotNames.TARGET
        );
        if ( targetAnnotation != null ) {
          attributeType = localBindingContext.locateClassByName(
View Full Code Here

   */
  private AttributeNature determineAttributeNature(Map<DotName, List<AnnotationInstance>> annotations) {
    EnumMap<AttributeNature, AnnotationInstance> discoveredAttributeTypes =
        new EnumMap<AttributeNature, AnnotationInstance>( AttributeNature.class );

    AnnotationInstance oneToOne = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ONE_TO_ONE );
    if ( oneToOne != null ) {
      discoveredAttributeTypes.put( AttributeNature.ONE_TO_ONE, oneToOne );
    }

    AnnotationInstance oneToMany = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ONE_TO_MANY );
    if ( oneToMany != null ) {
      discoveredAttributeTypes.put( AttributeNature.ONE_TO_MANY, oneToMany );
    }

    AnnotationInstance manyToOne = JandexHelper.getSingleAnnotation( annotations, JPADotNames.MANY_TO_ONE );
    if ( manyToOne != null ) {
      discoveredAttributeTypes.put( AttributeNature.MANY_TO_ONE, manyToOne );
    }

    AnnotationInstance manyToMany = JandexHelper.getSingleAnnotation( annotations, JPADotNames.MANY_TO_MANY );
    if ( manyToMany != null ) {
      discoveredAttributeTypes.put( AttributeNature.MANY_TO_MANY, manyToMany );
    }

    AnnotationInstance embedded = JandexHelper.getSingleAnnotation( annotations, JPADotNames.EMBEDDED );
    if ( embedded != null ) {
      discoveredAttributeTypes.put( AttributeNature.EMBEDDED, embedded );
    }

    AnnotationInstance embeddedId = JandexHelper.getSingleAnnotation( annotations, JPADotNames.EMBEDDED_ID );
    if ( embeddedId != null ) {
      discoveredAttributeTypes.put( AttributeNature.EMBEDDED_ID, embeddedId );
    }

    AnnotationInstance elementCollection = JandexHelper.getSingleAnnotation(
        annotations,
        JPADotNames.ELEMENT_COLLECTION
    );
    if ( elementCollection != null ) {
      discoveredAttributeTypes.put( AttributeNature.ELEMENT_COLLECTION, elementCollection );
View Full Code Here

  }

  private Map<String, AttributeOverride> findAttributeOverrides() {
    Map<String, AttributeOverride> attributeOverrideList = new HashMap<String, AttributeOverride>();

    AnnotationInstance attributeOverrideAnnotation = JandexHelper.getSingleAnnotation(
        classInfo,
        JPADotNames.ATTRIBUTE_OVERRIDE
    );
    if ( attributeOverrideAnnotation != null ) {
      String prefix = createPathPrefix( attributeOverrideAnnotation.target() );
      AttributeOverride override = new AttributeOverride( prefix, attributeOverrideAnnotation );
      attributeOverrideList.put( override.getAttributePath(), override );
    }

    AnnotationInstance attributeOverridesAnnotation = JandexHelper.getSingleAnnotation(
        classInfo,
        JPADotNames.ATTRIBUTE_OVERRIDES
    );
    if ( attributeOverridesAnnotation != null ) {
      AnnotationInstance[] annotationInstances = attributeOverridesAnnotation.value().asNestedArray();
      for ( AnnotationInstance annotationInstance : annotationInstances ) {
        String prefix = createPathPrefix( attributeOverridesAnnotation.target() );
        AttributeOverride override = new AttributeOverride( prefix, annotationInstance );
        attributeOverrideList.put( override.getAttributePath(), override );
      }
    }
    return attributeOverrideList;
View Full Code Here

  }

  private List<AnnotationInstance> findAssociationOverrides() {
    List<AnnotationInstance> associationOverrideList = new ArrayList<AnnotationInstance>();

    AnnotationInstance associationOverrideAnnotation = JandexHelper.getSingleAnnotation(
        classInfo,
        JPADotNames.ASSOCIATION_OVERRIDE
    );
    if ( associationOverrideAnnotation != null ) {
      associationOverrideList.add( associationOverrideAnnotation );
    }

    AnnotationInstance associationOverridesAnnotation = JandexHelper.getSingleAnnotation(
        classInfo,
        JPADotNames.ASSOCIATION_OVERRIDES
    );
    if ( associationOverrideAnnotation != null ) {
      AnnotationInstance[] attributeOverride = associationOverridesAnnotation.value().asNestedArray();
      Collections.addAll( associationOverrideList, attributeOverride );
    }

    return associationOverrideList;
  }
View Full Code Here

    return associationOverrideList;
  }

  private String determineCustomTuplizer() {
    final AnnotationInstance tuplizersAnnotation = JandexHelper.getSingleAnnotation(
        classInfo, HibernateDotNames.TUPLIZERS
    );
    if ( tuplizersAnnotation == null ) {
      return null;
    }

    AnnotationInstance[] annotations = JandexHelper.getValue(
        tuplizersAnnotation,
        "value",
        AnnotationInstance[].class
    );

    AnnotationInstance pojoTuplizerAnnotation = null;
    for ( AnnotationInstance tuplizerAnnotation : annotations ) {
      if ( EntityMode.valueOf( tuplizerAnnotation.value( "entityModeType" ).asEnum() ) == EntityMode.POJO ) {
        pojoTuplizerAnnotation = tuplizerAnnotation;
        break;
      }
    }

    String customTuplizer = null;
    if ( pojoTuplizerAnnotation != null ) {
      customTuplizer = pojoTuplizerAnnotation.value( "impl" ).asString();
    }
    return customTuplizer;
  }
View Full Code Here

      CoreMessageLogger.class,
      AccessHelper.class.getName()
  );

  static JaxbAccessType getAccessFromDefault(IndexBuilder indexBuilder) {
    AnnotationInstance annotationInstance = JandexHelper.getSingleAnnotation(
        indexBuilder.getAnnotations(),
        PseudoJpaDotNames.DEFAULT_ACCESS
    );
    if ( annotationInstance == null ) {
      return null;
View Full Code Here

TOP

Related Classes of org.jboss.jandex.AnnotationInstance

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.