1 4 5 package com.tc.aspectwerkz.expression.ast; 6 7 import com.tc.aspectwerkz.expression.regexp.Pattern; 8 import com.tc.aspectwerkz.expression.regexp.TypePattern; 9 import com.tc.aspectwerkz.expression.SubtypePatternType; 10 11 public class ASTConstructorPattern extends SimpleNode { 12 private TypePattern m_declaringTypePattern; 13 14 public ASTConstructorPattern(int id) { 15 super(id); 16 } 17 18 public ASTConstructorPattern(ExpressionParser p, int id) { 19 super(p, id); 20 } 21 22 public Object jjtAccept(ExpressionParserVisitor visitor, Object data) { 23 return visitor.visit(this, data); 24 } 25 26 public void setFullNamePattern(String pattern) { 27 int index = pattern.lastIndexOf('.'); 28 String classPattern = null; 29 if (index > 0) { 31 classPattern = pattern.substring(0, index); 32 } else { 33 classPattern = "*..*"; 35 } 36 if (classPattern.endsWith("+")) { 37 classPattern = classPattern.substring(0, classPattern.length() - 1); 38 m_declaringTypePattern = Pattern.compileTypePattern(classPattern, SubtypePatternType.MATCH_ON_ALL_METHODS); 39 } else if (classPattern.endsWith("#")) { 40 classPattern = classPattern.substring(0, classPattern.length() - 1); 41 m_declaringTypePattern = Pattern.compileTypePattern( 42 classPattern, 43 SubtypePatternType.MATCH_ON_BASE_TYPE_METHODS_ONLY 44 ); 45 } else { 46 m_declaringTypePattern = Pattern.compileTypePattern(classPattern, SubtypePatternType.NOT_HIERARCHICAL); 47 } 48 } 49 50 public TypePattern getDeclaringTypePattern() { 51 return m_declaringTypePattern; 52 } 53 } | Popular Tags |