1 25 26 package org.objectweb.easybeans.deployment.annotations.analyzer.classes; 27 28 import java.util.ArrayList ; 29 import java.util.List ; 30 31 import org.objectweb.easybeans.deployment.annotations.analyzer.JavaxAnnotationResourceVisitor; 32 import org.objectweb.easybeans.deployment.annotations.impl.JAnnotationResource; 33 import org.objectweb.easybeans.deployment.annotations.metadata.ClassAnnotationMetadata; 34 35 39 public class JavaxAnnotationResourcesVisitor extends JavaxAnnotationResourceVisitor<ClassAnnotationMetadata> { 40 41 44 public static final String TYPE = "Ljavax/annotation/Resources;"; 45 46 49 private List <JAnnotationResource> jAnnotationResources = null; 50 51 54 private boolean isAdded = false; 55 56 60 public JavaxAnnotationResourcesVisitor(final ClassAnnotationMetadata annotationMetadata) { 61 super(annotationMetadata); 62 jAnnotationResources = new ArrayList <JAnnotationResource>(); 63 } 64 65 73 @Override 74 public void visit(final String name, final Object value) { 75 if (jAnnotationResources.size() > 0 && isAdded) { 78 setJAnnotationResource(new JAnnotationResource()); 79 isAdded = false; 80 } 81 82 super.visit(name, value); 84 } 85 86 90 @Override 91 public void visitEnd() { 92 if (!isAdded) { 94 jAnnotationResources.add(getJAnnotationResource()); 95 isAdded = true; 96 } 97 98 getAnnotationMetadata().setJAnnotationResources(jAnnotationResources); 100 } 101 102 105 @Override 106 public String getType() { 107 return TYPE; 108 } 109 110 } 111 | Popular Tags |