Package org.jboss.jandex

Examples of org.jboss.jandex.ClassInfo


      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

    JaxbAccessType accessType = getAccessFromIdPosition( ormAnnotations );
    if ( accessType == null ) {
      accessType = getAccessFromIdPosition( indexedAnnotations );
    }
    if ( accessType == null ) {
      ClassInfo parent = indexBuilder.getClassInfo( className );
      if ( parent == null ) {
        parent = indexBuilder.getIndexedClassInfo( className );
      }
      if ( parent != null ) {
        DotName parentClassName = parent.superName();
        accessType = getAccessFromIdPosition( parentClassName, indexBuilder );
      }

    }
View Full Code Here

    JaxbAccessType accessType = getAccess( ormAnnotations );
    if ( accessType == null ) {
      accessType = getAccess( indexedAnnotations );
    }
    if ( accessType == null ) {
      ClassInfo parent = indexBuilder.getClassInfo( className );
      if ( parent == null ) {
        parent = indexBuilder.getIndexedClassInfo( className );
      }
      if ( parent != null ) {
        DotName parentClassName = parent.superName();
        accessType = getEntityAccess( parentClassName, indexBuilder );
      }
    }
    return accessType;
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

  }

  public Map<DotName, List<AnnotationInstance>> getIndexedAnnotations(DotName name) {
    Map<DotName, List<AnnotationInstance>> map = indexedClassInfoAnnotationsMap.get( name );
    if ( map == null ) {
      ClassInfo ci = index.getClassByName( name );
      if ( ci == null || ci.annotations() == null ) {
        map = Collections.emptyMap();
      }
      else {
        map = new HashMap<DotName, List<AnnotationInstance>>( ci.annotations() );
        //here we ignore global annotations
        for ( DotName globalAnnotationName : DefaultConfigurationHelper.GLOBAL_ANNOTATIONS ) {
          if ( map.containsKey( globalAnnotationName ) ) {
            map.put( globalAnnotationName, Collections.<AnnotationInstance>emptyList() );
          }
View Full Code Here

    }
    Class clazz = serviceRegistry.getService( ClassLoaderService.class ).classForName( className );
    DotName superName = null;
    DotName[] interfaces = null;
    short access_flag;
    ClassInfo annClassInfo = index.getClassByName( classDotName );
    if ( annClassInfo != null ) {
      superName = annClassInfo.superName();
      interfaces = annClassInfo.interfaces();
      access_flag = annClassInfo.flags();
    }
    else {
      Class superClass = clazz.getSuperclass();
      if ( superClass != null ) {
        superName = DotName.createSimple( superClass.getName() );
      }
      Class[] classInterfaces = clazz.getInterfaces();
      if ( classInterfaces != null && classInterfaces.length > 0 ) {
        interfaces = new DotName[classInterfaces.length];
        for ( int i = 0; i < classInterfaces.length; i++ ) {
          interfaces[i] = DotName.createSimple( classInterfaces[i].getName() );
        }
      }
      access_flag = (short) ( clazz.getModifiers() | 0x20 );//(modifiers | ACC_SUPER)
    }
    Map<DotName, List<AnnotationInstance>> map = new HashMap<DotName, List<AnnotationInstance>>();
    classInfoAnnotationsMap.put( classDotName, map );
    ClassInfo classInfo = ClassInfo.create(
        classDotName, superName, access_flag, interfaces, map
    );
    classes.put( classDotName, classInfo );
    addSubClasses( superName, classInfo );
    addImplementors( interfaces, classInfo );
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

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.