1 25 26 package org.objectweb.easybeans.deployment.annotations.analyzer; 27 28 import org.objectweb.asm.AnnotationVisitor; 29 import org.objectweb.asm.MethodVisitor; 30 import org.objectweb.easybeans.deployment.annotations.JMethod; 31 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxAnnotationPostConstructVisitor; 32 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxAnnotationPreDestroyVisitor; 33 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxAnnotationSecurityDenyAllVisitor; 34 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxEjbInitVisitor; 35 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxEjbPostActivateVisitor; 36 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxEjbPrePassivateVisitor; 37 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxEjbRemoveVisitor; 38 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxEjbTimeoutVisitor; 39 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxInterceptorAroundInvokeVisitor; 40 import org.objectweb.easybeans.deployment.annotations.analyzer.method.JavaxInterceptorExcludeClassInterceptorsVisitor; 41 import org.objectweb.easybeans.deployment.annotations.metadata.ClassAnnotationMetadata; 42 import org.objectweb.easybeans.deployment.annotations.metadata.MethodAnnotationMetadata; 43 44 48 public class ScanMethodVisitor extends ScanCommonVisitor<MethodAnnotationMetadata> implements MethodVisitor { 49 50 53 private MethodAnnotationMetadata methodAnnotationMetadata = null; 54 55 56 59 private ClassAnnotationMetadata classAnnotationMetadata = null; 60 61 66 public ScanMethodVisitor(final JMethod jMethod, final ClassAnnotationMetadata classAnnotationMetadata) { 67 68 this.methodAnnotationMetadata = new MethodAnnotationMetadata(jMethod, classAnnotationMetadata); 70 71 this.classAnnotationMetadata = classAnnotationMetadata; 73 74 initVisitors(); 75 } 76 77 80 private void initVisitors() { 81 super.initVisitors(methodAnnotationMetadata); 82 83 getAnnotationVisitors().put(JavaxEjbInitVisitor.TYPE, new JavaxEjbInitVisitor(methodAnnotationMetadata)); 85 86 getAnnotationVisitors().put(JavaxEjbRemoveVisitor.TYPE, new JavaxEjbRemoveVisitor(methodAnnotationMetadata)); 88 89 getAnnotationVisitors().put(JavaxEjbTransactionAttributeVisitor.TYPE, 91 new JavaxEjbTransactionAttributeVisitor<MethodAnnotationMetadata>(methodAnnotationMetadata)); 92 93 getAnnotationVisitors().put(JavaxAnnotationPostConstructVisitor.TYPE, 95 new JavaxAnnotationPostConstructVisitor(methodAnnotationMetadata)); 96 getAnnotationVisitors().put(JavaxAnnotationPreDestroyVisitor.TYPE, 98 new JavaxAnnotationPreDestroyVisitor(methodAnnotationMetadata)); 99 getAnnotationVisitors().put(JavaxEjbPostActivateVisitor.TYPE, new JavaxEjbPostActivateVisitor(methodAnnotationMetadata)); 101 getAnnotationVisitors().put(JavaxEjbPrePassivateVisitor.TYPE, new JavaxEjbPrePassivateVisitor(methodAnnotationMetadata)); 103 104 getAnnotationVisitors().put(JavaxEjbTimeoutVisitor.TYPE, new JavaxEjbTimeoutVisitor(methodAnnotationMetadata)); 106 107 getAnnotationVisitors().put(JavaxInterceptorAroundInvokeVisitor.TYPE, 109 new JavaxInterceptorAroundInvokeVisitor(methodAnnotationMetadata)); 110 111 getAnnotationVisitors().put(JavaxInterceptorInterceptorsVisitor.TYPE, 113 new JavaxInterceptorInterceptorsVisitor<MethodAnnotationMetadata>(methodAnnotationMetadata)); 114 115 getAnnotationVisitors().put(JavaxInterceptorExcludeClassInterceptorsVisitor.TYPE, 117 new JavaxInterceptorExcludeClassInterceptorsVisitor(methodAnnotationMetadata)); 118 119 getAnnotationVisitors().put(JavaxAnnotationSecurityRolesAllowedVisitor.TYPE, 121 new JavaxAnnotationSecurityRolesAllowedVisitor<MethodAnnotationMetadata>(methodAnnotationMetadata)); 122 123 getAnnotationVisitors().put(JavaxAnnotationSecurityPermitAllVisitor.TYPE, 125 new JavaxAnnotationSecurityPermitAllVisitor<MethodAnnotationMetadata>(methodAnnotationMetadata)); 126 127 getAnnotationVisitors().put(JavaxAnnotationSecurityDenyAllVisitor.TYPE, 129 new JavaxAnnotationSecurityDenyAllVisitor(methodAnnotationMetadata)); 130 131 } 132 133 142 @Override 143 public AnnotationVisitor visitAnnotationDefault() { 144 return getEmptyVisitor(); 145 } 146 147 148 156 @Override 157 public AnnotationVisitor visitParameterAnnotation(final int parameter, final String desc, final boolean visible) { 158 return getEmptyVisitor(); 159 } 160 161 166 @Override 167 public void visitEnd() { 168 classAnnotationMetadata.addMethodAnnotationMetadata(methodAnnotationMetadata); 169 } 170 171 172 173 } 174 | Popular Tags |