01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04:
05: package com.tc.aspectwerkz.expression.ast;
06:
07: import com.tc.aspectwerkz.expression.regexp.Pattern;
08: import com.tc.aspectwerkz.expression.regexp.TypePattern;
09: 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: //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
38: .length() - 1);
39: m_declaringTypePattern = Pattern.compileTypePattern(
40: classPattern,
41: SubtypePatternType.MATCH_ON_ALL_METHODS);
42: } else if (classPattern.endsWith("#")) {
43: classPattern = classPattern.substring(0, classPattern
44: .length() - 1);
45: m_declaringTypePattern = Pattern.compileTypePattern(
46: classPattern,
47: SubtypePatternType.MATCH_ON_BASE_TYPE_METHODS_ONLY);
48: } else {
49: m_declaringTypePattern = Pattern.compileTypePattern(
50: classPattern, SubtypePatternType.NOT_HIERARCHICAL);
51: }
52: }
53:
54: public TypePattern getDeclaringTypePattern() {
55: return m_declaringTypePattern;
56: }
57: }
|