1 4 package com.tc.aspectwerkz.annotation; 5 6 7 import com.tc.aspectwerkz.DeploymentModel; 8 import com.tc.aspectwerkz.expression.ExpressionInfo; 9 import com.tc.aspectwerkz.expression.ExpressionNamespace; 10 import com.tc.aspectwerkz.reflect.ClassInfo; 11 import com.tc.aspectwerkz.definition.DefinitionParserHelper; 12 import com.tc.aspectwerkz.definition.MixinDefinition; 13 import com.tc.aspectwerkz.definition.SystemDefinition; 14 15 20 public class MixinAnnotationParser { 21 22 25 private final static MixinAnnotationParser INSTANCE = new MixinAnnotationParser(); 26 27 30 private MixinAnnotationParser() { 31 } 32 33 39 public static void parse(final ClassInfo classInfo, final MixinDefinition mixinDef) { 40 INSTANCE.doParse(classInfo, mixinDef); 41 } 42 43 49 private void doParse(final ClassInfo classInfo, final MixinDefinition mixinDef) { 50 if (classInfo == null) { 51 throw new IllegalArgumentException ("class to parse can not be null"); 52 } 53 final SystemDefinition systemDef = mixinDef.getSystemDefinition(); 54 com.tc.aspectwerkz.annotation.Mixin annotation = (Mixin) AsmAnnotations.getAnnotation(AnnotationConstants.MIXIN, classInfo); 55 if (annotation != null) { 56 String expression = AspectAnnotationParser.getExpressionElseValue( 57 annotation.value(), annotation.pointcut() 58 ); 59 final ExpressionInfo expressionInfo = new ExpressionInfo(expression, systemDef.getUuid()); 60 ExpressionNamespace.getNamespace(systemDef.getUuid()).addExpressionInfo( 61 DefinitionParserHelper.EXPRESSION_PREFIX + expression.hashCode(), 62 expressionInfo 63 ); 64 mixinDef.addExpressionInfo(expressionInfo); 65 mixinDef.setTransient(annotation.isTransient()); 66 if (annotation.deploymentModel() != null) { 67 mixinDef.setDeploymentModel(DeploymentModel.getDeploymentModelFor(annotation.deploymentModel())); 68 } 69 } 70 } 71 } | Popular Tags |