KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > aspectwerkz > expression > ast > ASTConstructorPattern


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

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 JavaDoc jjtAccept(ExpressionParserVisitor visitor, Object JavaDoc data) {
23     return visitor.visit(this, data);
24   }
25
26   public void setFullNamePattern(String JavaDoc pattern) {
27     int index = pattern.lastIndexOf('.');
28     String JavaDoc classPattern = null;
29     //Aw-112 support for "new(..)"
30
if (index > 0) {
31       classPattern = pattern.substring(0, index);
32     } else {
33       // unspecified classPattern like "new(..)"
34
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