01: package org.codehaus.aspectwerkz.expression.ast;
02:
03: import org.codehaus.aspectwerkz.expression.SubtypePatternType;
04: import org.codehaus.aspectwerkz.expression.regexp.Pattern;
05: import org.codehaus.aspectwerkz.expression.regexp.TypePattern;
06:
07: public class ASTConstructorPattern extends SimpleNode {
08: private TypePattern m_declaringTypePattern;
09:
10: public ASTConstructorPattern(int id) {
11: super (id);
12: }
13:
14: public ASTConstructorPattern(ExpressionParser p, int id) {
15: super (p, id);
16: }
17:
18: public Object jjtAccept(ExpressionParserVisitor visitor, Object data) {
19: return visitor.visit(this , data);
20: }
21:
22: public void setFullNamePattern(String pattern) {
23: int index = pattern.lastIndexOf('.');
24: String classPattern = null;
25: //Aw-112 support for "new(..)"
26: if (index > 0) {
27: classPattern = pattern.substring(0, index);
28: } else {
29: // unspecified classPattern like "new(..)"
30: classPattern = "*..*";
31: }
32: if (classPattern.endsWith("+")) {
33: classPattern = classPattern.substring(0, classPattern
34: .length() - 1);
35: m_declaringTypePattern = Pattern.compileTypePattern(
36: classPattern,
37: SubtypePatternType.MATCH_ON_ALL_METHODS);
38: } else if (classPattern.endsWith("#")) {
39: classPattern = classPattern.substring(0, classPattern
40: .length() - 1);
41: m_declaringTypePattern = Pattern.compileTypePattern(
42: classPattern,
43: SubtypePatternType.MATCH_ON_BASE_TYPE_METHODS_ONLY);
44: } else {
45: m_declaringTypePattern = Pattern.compileTypePattern(
46: classPattern, SubtypePatternType.NOT_HIERARCHICAL);
47: }
48: }
49:
50: public TypePattern getDeclaringTypePattern() {
51: return m_declaringTypePattern;
52: }
53: }
|