Package org.jboss.jandex

Examples of org.jboss.jandex.Index


        PersistenceUnitMetadata pu = PERSISTENCE_UNIT_METADATA_TLS.get();
        if (pu == null) {
            throw MESSAGES.missingPersistenceUnitMetadata();
        }
        if (pu.getAnnotationIndex() != null) {
            Index index = getJarFileIndex(jarToScan, pu);
            if (index == null) {
                JPA_LOGGER.tracef("No classes to scan for annotations in jar '%s' (jars with classes '%s')",
                    jarToScan, pu.getAnnotationIndex().keySet());
                return new HashSet<Class<?>>();
            }
            if (annotationsToLookFor == null) {
                throw MESSAGES.nullVar("annotationsToLookFor");
            }
            if (annotationsToLookFor.size() == 0) {
                throw MESSAGES.emptyParameter("annotationsToLookFor");
            }

            Set<Class<?>> result = new HashSet<Class<?>>();

            for (Class<? extends Annotation> annClass : annotationsToLookFor) {
                DotName annotation = DotName.createSimple(annClass.getName());
                List<AnnotationInstance> classesWithAnnotation = index.getAnnotations(annotation);
                Set<Class<?>> classesForAnnotation = new HashSet<Class<?>>();
                for (AnnotationInstance annotationInstance : classesWithAnnotation) {
                    // verify that the annotation target is actually a class, since some frameworks
                    // may generate bytecode with annotations placed on methods (see AS7-2559)
                    if (annotationInstance.target() instanceof ClassInfo) {
View Full Code Here


        if (annotationsToLookFor.size() > 0) {  // Hibernate doesn't pass any annotations currently
            resultClasses = getClassesInJar(jarToScan, annotationsToLookFor);
        } else {
            if (pu.getAnnotationIndex() != null) {
                Index index = getJarFileIndex(jarToScan, pu);
                if (index == null) {
                    JPA_LOGGER.tracef("No classes to scan for annotations in jar '%s' (jars with classes '%s')",
                        jarToScan, pu.getAnnotationIndex().keySet());
                    return new HashSet<Package>();
                }
                Collection<ClassInfo> allClasses = index.getKnownClasses();
                for (ClassInfo classInfo : allClasses) {
                    String className = classInfo.name().toString();
                    try {
                        resultClasses.add(pu.getClassLoader().loadClass(className));
                        // TODO:  fix temp classloader (get CFNE on entity class)
View Full Code Here

        PersistenceUnitMetadata pu = persistenceUnitMetadataTLS.get();
        if (pu == null) {
            throw MESSAGES.missingPersistenceUnitMetadata();
        }
        if (pu.getAnnotationIndex() != null) {
            Index index = getJarFileIndex(jartoScan, pu);
            if (index == null) {
                JPA_LOGGER.tracef("No classes to scan for annotations in jar '%s' (jars with classes '%s')",
                    jartoScan, pu.getAnnotationIndex().keySet());
                return new HashSet<Class<?>>();
            }
            if (annotationsToLookFor == null) {
                throw MESSAGES.nullVar("annotationsToLookFor");
            }
            if (annotationsToLookFor.size() == 0) {
                throw MESSAGES.emptyParameter("annotationsToLookFor");
            }

            Set<Class<?>> result = new HashSet<Class<?>>();

            for (Class<? extends Annotation> annClass : annotationsToLookFor) {
                DotName annotation = DotName.createSimple(annClass.getName());
                List<AnnotationInstance> classesWithAnnotation = index.getAnnotations(annotation);
                Set<Class<?>> classesForAnnotation = new HashSet<Class<?>>();
                for (AnnotationInstance annotationInstance : classesWithAnnotation) {
                    // verify that the annotation target is actually a class, since some frameworks
                    // may generate bytecode with annotations placed on methods (see AS7-2559)
                    if (annotationInstance.target() instanceof ClassInfo) {
View Full Code Here

                throw MESSAGES.missingPersistenceUnitMetadata();
            }
            if (jartoScan == null) {
                throw MESSAGES.nullVar("jarToScan");
            }
            Index index = getJarFileIndex(jartoScan, pu);
            if (index == null) {
                JPA_LOGGER.tracef("No classes to scan for annotations in jar '%s' (jars with classes '%s')",
                    jartoScan, pu.getAnnotationIndex().keySet());
                return new HashSet<Package>();
            }
            Collection<ClassInfo> allClasses = index.getKnownClasses();
            for (ClassInfo classInfo : allClasses) {
                String className = classInfo.name().toString();
                try {
                    resultClasses.add(pu.getClassLoader().loadClass(className));
                    // TODO:  fix temp classloader (get CFNE on entity class)
View Full Code Here

            throw MESSAGES.missingPersistenceUnitMetadata();
        }
        if (jartoScan == null) {
            throw MESSAGES.nullVar("jarToScan");
        }
        Index index = getJarFileIndex(jartoScan, pu);
        if (index == null) {
            JPA_LOGGER.tracef("No classes to scan for annotations in jar '%s' (jars with classes '%s')",
                jartoScan, pu.getAnnotationIndex().keySet());
            return new HashSet<Class<?>>();
        }
        if (annotationsToLookFor == null) {
            throw MESSAGES.nullVar("annotationsToLookFor");
        }
        if (annotationsToLookFor.size() == 0) {
            throw MESSAGES.emptyParameter("annotationsToLookFor");
        }

        Set<Class<?>> result = new HashSet<Class<?>>();

        for (Class<? extends Annotation> annClass : annotationsToLookFor) {
            DotName annotation = DotName.createSimple(annClass.getName());
            List<AnnotationInstance> classesWithAnnotation = index.getAnnotations(annotation);
            for (AnnotationInstance annotationInstance : classesWithAnnotation) {
                // verify that the annotation target is actually a class, since some frameworks
                // may generate bytecode with annotations placed on methods (see AS7-2559)
                if (annotationInstance.target() instanceof ClassInfo) {
                    String className = annotationInstance.target().toString();
View Full Code Here

        for (ResourceRoot resourceRoot : potentialSubDeployments) {
            if (ModuleRootMarker.isModuleRoot(resourceRoot)) {
                // module roots cannot be managed bean jars
                continue;
            }
            final Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
            if (index != null) {
                if (!index.getAnnotations(MANAGED_BEAN).isEmpty()) {
                    //this is an managed bean deployment
                    SubDeploymentMarker.mark(resourceRoot);
                    ModuleRootMarker.mark(resourceRoot);
                }
            }
View Full Code Here

            VirtualFile ejbJarFile = resourceRoot.getRoot().getChild("META-INF/ejb-jar.xml");
            if (ejbJarFile.exists()) {
                SubDeploymentMarker.mark(resourceRoot);
                ModuleRootMarker.mark(resourceRoot);
            } else {
                final Index index = resourceRoot.getAttachment(Attachments.ANNOTATION_INDEX);
                if (index != null) {
                    if (!index.getAnnotations(STATEFULL).isEmpty() ||
                            !index.getAnnotations(STATELESS).isEmpty() ||
                            !index.getAnnotations(MESSAGE_DRIVEN).isEmpty() ||
                            !index.getAnnotations(SINGLETON).isEmpty()) {
                        //this is an EJB deployment
                        //TODO: we need to mark EJB sub deployments so the sub deployers know they are EJB deployments
                        SubDeploymentMarker.mark(resourceRoot);
                        ModuleRootMarker.mark(resourceRoot);
                    }
View Full Code Here

    // add package-info from the configured packages
    for ( String packageName : sources.getAnnotatedPackages() ) {
      indexClass( indexer, packageName.replace( '.', '/' ) + "/package-info.class" );
    }

    Index index = indexer.complete();

    List<JaxbRoot<JaxbEntityMappings>> mappings = new ArrayList<JaxbRoot<JaxbEntityMappings>>();
    for ( JaxbRoot<?> root : sources.getJaxbRootList() ) {
      if ( root.getRoot() instanceof JaxbEntityMappings ) {
        mappings.add( (JaxbRoot<JaxbEntityMappings>) root );
      }
    }
    if ( !mappings.isEmpty() ) {
      index = parseAndUpdateIndex( mappings, index );
    }

    if ( index.getAnnotations( PseudoJpaDotNames.DEFAULT_DELIMITED_IDENTIFIERS ) != null ) {
      // todo : this needs to move to AnnotationBindingContext
      // what happens right now is that specifying this in an orm.xml causes it to effect all orm.xmls
      metadata.setGloballyQuotedIdentifiers( true );
    }
    bindingContext = new AnnotationBindingContextImpl( metadata, index );
View Full Code Here

  public static Set<EntityHierarchy> createEntityHierarchies(AnnotationBindingContext bindingContext) {
    Set<EntityHierarchy> hierarchies = new HashSet<EntityHierarchy>();

    List<DotName> processedEntities = new ArrayList<DotName>();
    Map<DotName, List<ClassInfo>> classToDirectSubClassMap = new HashMap<DotName, List<ClassInfo>>();
    Index index = bindingContext.getIndex();
    for ( ClassInfo info : index.getKnownClasses() ) {
      if ( !isEntityClass( info ) ) {
        continue;
      }

      if ( processedEntities.contains( info.name() ) ) {
View Full Code Here

        if (annotationsToLookFor.size() > 0) {  // Hibernate doesn't pass any annotations currently
            resultClasses = getClassesInJar(jartoScan, annotationsToLookFor);
        } else {
            if (pu.getAnnotationIndex() != null) {
                Index index = getJarFileIndex(jartoScan, pu);
                if (index == null) {
                    JPA_LOGGER.tracef("No classes to scan for annotations in jar '%s' (jars with classes '%s')",
                        jartoScan, pu.getAnnotationIndex().keySet());
                    return new HashSet<Package>();
                }
                Collection<ClassInfo> allClasses = index.getKnownClasses();
                for (ClassInfo classInfo : allClasses) {
                    String className = classInfo.name().toString();
                    try {
                        resultClasses.add(pu.getClassLoader().loadClass(className));
                        // TODO:  fix temp classloader (get CFNE on entity class)
View Full Code Here

TOP

Related Classes of org.jboss.jandex.Index

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.