Package org.jboss.jandex

Examples of org.jboss.jandex.ClassInfo


        for (AnnotationInstance instance : instances) {
            AnnotationTarget target = instance.target();
            if (!(target instanceof ClassInfo)) {
                throw new DeploymentUnitProcessingException("The ManagedBean annotation is only allowed at the class level: " + target);
            }
            final ClassInfo classInfo = (ClassInfo) target;
            // skip if it's not a valid managed bean class
            if (!assertManagedBeanClassValidity(classInfo)) {
                continue;
            }
            final String beanClassName = classInfo.name().toString();

            // Get the managed bean name from the annotation
            final AnnotationValue nameValue = instance.value();
            final String beanName = nameValue == null || nameValue.asString().isEmpty() ? beanClassName : nameValue.asString();
            final ComponentDescription componentDescription = new ComponentDescription(beanName, beanClassName, moduleDescription, applicationClasses.getOrAddClassByName(beanClassName), deploymentUnit.getServiceName(), applicationClasses);
View Full Code Here


    return create( ENTITY_LISTENERS, classInfo, annotationValueList );
  }

  private void parserEntityListener(JaxbEntityListener listener) {
    String clazz = listener.getClazz();
    ClassInfo tempClassInfo = indexBuilder.createClassInfo( clazz );
    ListenerMocker mocker = createListenerMocker( indexBuilder, tempClassInfo );
    mocker.parser( listener.getPostLoad() );
    mocker.parser( listener.getPostPersist() );
    mocker.parser( listener.getPostRemove() );
    mocker.parser( listener.getPostUpdate() );
    mocker.parser( listener.getPrePersist() );
    mocker.parser( listener.getPreRemove() );
    mocker.parser( listener.getPreUpdate() );
    indexBuilder.finishEntityObject( tempClassInfo.name(), null );
  }
View Full Code Here

   *
   * @return a set of {@code ConfiguredClassHierarchy}s. One for each "leaf" entity.
   */
  public static EmbeddableHierarchy createEmbeddableHierarchy(Class<?> embeddableClass, String propertyName, AccessType accessType, AnnotationBindingContext context) {

    ClassInfo embeddableClassInfo = context.getClassInfo( embeddableClass.getName() );
    if ( embeddableClassInfo == null ) {
      throw new AssertionFailure(
          String.format(
              "The specified class %s cannot be found in the annotation index",
              embeddableClass.getName()
          )
      );
    }

    if ( JandexHelper.getSingleAnnotation( embeddableClassInfo, JPADotNames.EMBEDDABLE ) == null ) {
      throw new AssertionFailure(
          String.format(
              "The specified class %s is not annotated with @Embeddable even though it is as embeddable",
              embeddableClass.getName()
          )
      );
    }

    List<ClassInfo> classInfoList = new ArrayList<ClassInfo>();
    ClassInfo tmpClassInfo;
    Class<?> clazz = embeddableClass;
    while ( clazz != null && !clazz.equals( Object.class ) ) {
      tmpClassInfo = context.getIndex().getClassByName( DotName.createSimple( clazz.getName() ) );
      clazz = clazz.getSuperclass();
      if ( tmpClassInfo == null ) {
View Full Code Here

    Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
    List<AnnotationInstance> accessAnnotationInstances = indexedAnnotations.get( ACCESS );
    if ( MockHelper.isNotEmpty( accessAnnotationInstances ) ) {
      for ( AnnotationInstance annotationInstance : accessAnnotationInstances ) {
        if ( annotationInstance.target() != null && annotationInstance.target() instanceof ClassInfo ) {
          ClassInfo ci = (ClassInfo) ( annotationInstance.target() );
          if ( className.equals( ci.name() ) ) {
            //todo does ci need to have @Entity or @MappedSuperClass ??
            return AccessType.valueOf( annotationInstance.value().asEnum() );
          }
        }
      }
View Full Code Here

      if ( processedEntities.contains( info.name() ) ) {
        continue;
      }

      ClassInfo rootClassInfo = findRootEntityClassInfo( index, info );
      List<ClassInfo> rootClassWithAllSubclasses = new ArrayList<ClassInfo>();
      // the root entity might have some mapped super classes which we have to take into consideration
      // for inheritance type and default access
      addMappedSuperclasses( index, rootClassInfo, rootClassWithAllSubclasses );
View Full Code Here

   * @param info the class info representing an entity
   *
   * @return Finds the root entity starting at the entity given by {@code info}
   */
  private static ClassInfo findRootEntityClassInfo(Index index, ClassInfo info) {
    ClassInfo rootEntity = info;

    DotName superName = info.superName();
    ClassInfo tmpInfo;
    // walk up the hierarchy until java.lang.Object
    while ( !OBJECT.equals( superName ) ) {
      tmpInfo = index.getClassByName( superName );
      if ( isEntityClass( tmpInfo ) ) {
        rootEntity = tmpInfo;
      }
      superName = tmpInfo.superName();
    }
    return rootEntity;
  }
View Full Code Here

    return rootEntity;
  }

  private static void addMappedSuperclasses(Index index, ClassInfo info, List<ClassInfo> classInfoList) {
    DotName superName = info.superName();
    ClassInfo tmpInfo;
    // walk up the hierarchy until java.lang.Object
    while ( !OBJECT.equals( superName ) ) {
      tmpInfo = index.getClassByName( superName );
      if ( isMappedSuperclass( tmpInfo ) ) {
        classInfoList.add( tmpInfo );
      }
      superName = tmpInfo.superName();
    }
  }
View Full Code Here

      }
    }
  }

  private void resolveEmbeddable(String attributeName, Class<?> type) {
    ClassInfo embeddableClassInfo = localBindingContext.getClassInfo( type.getName() );
    if ( embeddableClassInfo == null ) {
      String msg = String.format(
          "Attribute '%s#%s' is annotated with @Embedded, but '%s' does not seem to be annotated " +
              "with @Embeddable. Are all annotated classes added to the configuration?",
          getConfiguredClass().getSimpleName(),
          attributeName,
          type.getSimpleName()
      );
      throw new AnnotationException( msg );
    }

    localBindingContext.resolveAllTypes( type.getName() );
    EmbeddableHierarchy hierarchy = EmbeddableHierarchy.createEmbeddableHierarchy(
        localBindingContext.<Object>locateClassByName( embeddableClassInfo.toString() ),
        attributeName,
        classAccessType,
        localBindingContext
    );
    embeddedClasses.put( attributeName, hierarchy.getLeaf() );
View Full Code Here

    return callbackClassList;
  }

  private void processDefaultJpaCallbacks(String instanceCallbackClassName, List<JpaCallbackClass> jpaCallbackClassList) {
    ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );

    // Process superclass first if available and not excluded
    if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
      DotName superName = callbackClassInfo.superName();
      if ( superName != null ) {
        processDefaultJpaCallbacks( instanceCallbackClassName, jpaCallbackClassList );
      }
    }

    String callbackClassName = callbackClassInfo.name().toString();
    Map<Class<?>, String> callbacksByType = new HashMap<Class<?>, String>();
    createDefaultCallback(
        PrePersist.class, PseudoJpaDotNames.DEFAULT_PRE_PERSIST, callbackClassName, callbacksByType
    );
    createDefaultCallback(
View Full Code Here

    }
  }

  private void processJpaCallbacks(String instanceCallbackClassName, boolean isListener, List<JpaCallbackClass> callbackClassList) {

    ClassInfo callbackClassInfo = getLocalBindingContext().getClassInfo( instanceCallbackClassName );

    // Process superclass first if available and not excluded
    if ( JandexHelper.getSingleAnnotation( callbackClassInfo, JPADotNames.EXCLUDE_SUPERCLASS_LISTENERS ) != null ) {
      DotName superName = callbackClassInfo.superName();
      if ( superName != null ) {
        processJpaCallbacks(
            instanceCallbackClassName,
            isListener,
            callbackClassList
View Full Code Here

TOP

Related Classes of org.jboss.jandex.ClassInfo

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.