KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > codehaus > aspectwerkz > expression > ast > ASTConstructorPattern


1 package org.codehaus.aspectwerkz.expression.ast;
2
3 import org.codehaus.aspectwerkz.expression.SubtypePatternType;
4 import org.codehaus.aspectwerkz.expression.regexp.Pattern;
5 import org.codehaus.aspectwerkz.expression.regexp.TypePattern;
6
7 public class ASTConstructorPattern extends SimpleNode {
8     private TypePattern m_declaringTypePattern;
9
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 JavaDoc jjtAccept(ExpressionParserVisitor visitor, Object JavaDoc data) {
19         return visitor.visit(this, data);
20     }
21
22     public void setFullNamePattern(String JavaDoc pattern) {
23         int index = pattern.lastIndexOf('.');
24         String JavaDoc 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.length() - 1);
34             m_declaringTypePattern = Pattern.compileTypePattern(classPattern, SubtypePatternType.MATCH_ON_ALL_METHODS);
35         } else if (classPattern.endsWith("#")) {
36             classPattern = classPattern.substring(0, classPattern.length() - 1);
37             m_declaringTypePattern = Pattern.compileTypePattern(
38                     classPattern,
39                     SubtypePatternType.MATCH_ON_BASE_TYPE_METHODS_ONLY
40             );
41         } else {
42             m_declaringTypePattern = Pattern.compileTypePattern(classPattern, SubtypePatternType.NOT_HIERARCHICAL);
43         }
44     }
45
46     public TypePattern getDeclaringTypePattern() {
47         return m_declaringTypePattern;
48     }
49 }
Popular Tags