Package org.jboss.scanning.annotations.spi

Examples of org.jboss.scanning.annotations.spi.AnnotationRepository


   @SuppressWarnings("unchecked")
   protected Collection<Class<?>> getClasses(VFSDeploymentUnit unit, AbstractCreator creator)
   {
      boolean trace = log.isTraceEnabled();

      AnnotationRepository env = unit.getAttachment(AnnotationIndex.class);
      if (env == null)
      {
         if (trace)
            log.trace("Cannot scan classes, missing AnnotationRepository as attachment: " + unit.getName());
         return Collections.emptySet();
      }

      String creatorInfo = creator.toString();
      AnnotationContext context = creator.getAnnotationContext();
      Set<Class<?>> classes = new HashSet<Class<?>>();

      Collection<Class<? extends Annotation>> typeAnnotations = context.getTypeAnnotations();
      if (trace)
         log.trace("Creator: " + creatorInfo + ", type annotations: " + typeAnnotations);
      for(Class<? extends Annotation> annotation : typeAnnotations)
      {
         Class<Annotation> annotationClass = (Class<Annotation>)annotation;
         Set<Element<Annotation, Class<?>>> elements = env.classIsAnnotatedWith(annotationClass);
         for(Element<Annotation, Class<?>> elt : elements)
               classes.add(elt.getOwner());
      }

      Collection<Class<? extends Annotation>> methodAnnotations = context.getMethodAnnotations();
      if (trace)
         log.trace("Creator: " + creatorInfo + ", method annotations: " + methodAnnotations);
      for(Class<? extends Annotation> annotation : methodAnnotations)
      {
         Class<Annotation> annotationClass = (Class<Annotation>)annotation;
         Set<Element<Annotation, Method>> elements = env.classHasMethodAnnotatedWith(annotationClass);
         for(Element<Annotation, Method> elt : elements)
            classes.add(elt.getOwner());
      }

      Collection<Class<? extends Annotation>> fieldAnnotations = context.getFieldAnnotations();
      if (trace)
         log.trace("Creator: " + creatorInfo + ", field annotations: " + fieldAnnotations);
      for(Class<? extends Annotation> annotation : fieldAnnotations)
      {
         Class<Annotation> annotationClass = (Class<Annotation>)annotation;
         Set<Element<Annotation, Field>> elements = env.classHasFieldAnnotatedWith(annotationClass);
         for(Element<Annotation, Field> elt : elements)
            classes.add(elt.getOwner());
      }

      if (trace)
View Full Code Here


   }

   @SuppressWarnings("unchecked")
   protected Collection<Class<?>> getClasses(VFSDeploymentUnit unit, String mainClassName, List<VirtualFile> classpath) throws IOException
   {
      AnnotationRepository env = unit.getAttachment(AnnotationRepository.class);
      if (env == null)
      {
         if (log.isTraceEnabled())
            log.trace("Cannot scan classes, missing AnnotationRepository as attachment: " + unit.getName());
         return Collections.emptySet();
      }

      Set<Class<?>> classes = new HashSet<Class<?>>();
      for(Class<? extends Annotation> annotation : annotationOnClass)
      {
         Class<Annotation> annotationClass = (Class<Annotation>)annotation;
         Set<Element<Annotation, Class<?>>> elements = env.classIsAnnotatedWith(annotationClass);
         for(Element<Annotation, Class<?>> elt : elements)
            classes.add(elt.getOwner());
      }
      for(Class<? extends Annotation> annotation : annotationOnMethod)
      {
         Class<Annotation> annotationClass = (Class<Annotation>)annotation;
         Set<Element<Annotation, Method>> elements = env.classHasMethodAnnotatedWith(annotationClass);
         for(Element<Annotation, Method> elt : elements)
            classes.add(elt.getOwner());
      }
      for(Class<? extends Annotation> annotation : annotationOnField)
      {
         Class<Annotation> annotationClass = (Class<Annotation>)annotation;
         Set<Element<Annotation, Field>> elements = env.classHasFieldAnnotatedWith(annotationClass);
         for(Element<Annotation, Field> elt : elements)
            classes.add(elt.getOwner());
      }

      if(log.isTraceEnabled() && classes.isEmpty() == false)
View Full Code Here

         return true;

      boolean result = false;
      for(VirtualFile root : roots)
      {
         AnnotationRepository env = createAnnotationRepository(root);
         for (Class<? extends Annotation> annotationClass : candidateAnnotations)
         {
            if (env.hasClassAnnotatedWith(annotationClass))
            {
               result = true;
               for (CandidateAnnotationsCallback callback : callbacks)
                  callback.executeCallback(root, context, env, annotationClass);
            }
View Full Code Here

         return true;

      boolean result = false;
      for(VirtualFile root : roots)
      {
         AnnotationRepository env = createAnnotationRepository(root);
         for (Class<? extends Annotation> annotationClass : candidateAnnotations)
         {
            if (env.hasClassAnnotatedWith(annotationClass))
            {
               result = true;
               for (CandidateAnnotationsCallback callback : callbacks)
                  callback.executeCallback(root, context, env, annotationClass);
            }
View Full Code Here

         AnnotationsScanningPlugin plugin = new AnnotationsScanningPlugin(unit.getClassLoader());
         scanner.addPlugin(plugin);

         scanner.scan();

         AnnotationRepository repository = unit.getAttachment(plugin.getAttachmentKey(), AnnotationRepository.class);
         unit.addAttachment(AnnotationRepository.class, repository);
      }
      catch (Exception e)
      {
         throw DeploymentException.rethrowAsDeploymentException("Cannot create AR", e);
View Full Code Here

         configureScanner(scanner);

         scanner.scan();

         AnnotationRepository repository = unit.getAttachment(plugin.getAttachmentKey(), AnnotationRepository.class);
         unit.addAttachment(AnnotationRepository.class, repository);
      }
      catch (Exception e)
      {
         throw DeploymentException.rethrowAsDeploymentException("Exception visiting module", e);
View Full Code Here

         return true;

      boolean result = false;
      for(VirtualFile root : roots)
      {
         AnnotationRepository env = createAnnotationRepository(root);
         for (Class<? extends Annotation> annotationClass : candidateAnnotations)
         {
            if (env.hasClassAnnotatedWith(annotationClass))
            {
               result = true;
               for (CandidateAnnotationsCallback callback : callbacks)
                  callback.executeCallback(root, context, env, annotationClass);
            }
View Full Code Here

TOP

Related Classes of org.jboss.scanning.annotations.spi.AnnotationRepository

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.