1 22 23 package org.jboss.aop.pointcut.ast; 24 25 import java.util.ArrayList ; 26 27 public class ASTConstructor extends SimpleNode 28 { 29 public ASTConstructor(int id) 30 { 31 super(id); 32 } 33 34 public ASTConstructor(PointcutExpressionParser p, int id) 35 { 36 super(p, id); 37 } 38 39 40 41 public Object jjtAccept(PointcutExpressionParserVisitor visitor, Object data) 42 { 43 return visitor.visit(this, data); 44 } 45 46 public Object jjtAccept(TypeExpressionParserVisitor visitor, Object data) 47 { 48 return visitor.visit(this, data); 49 } 50 51 String classExpr; 52 ClassExpression clazz; 53 IdentifierExpression annotation; 54 ArrayList attributes = new ArrayList (); 55 ArrayList parameters = new ArrayList (); 56 boolean anyParameters = false; 57 boolean hasAnyZeroOrMoreParameters = false; 58 ArrayList exceptions = new ArrayList (); 59 60 public void jjtAddChild(Node n, int i) 61 { 62 if (n instanceof ASTAttribute) attributes.add(n); 63 else if (n instanceof ASTException) exceptions.add(n); 64 else if (n instanceof ASTAllParameter) anyParameters = true; 65 else if (n instanceof ASTParameter && !anyParameters) 66 { 67 parameters.add(0,n); 68 if (!hasAnyZeroOrMoreParameters && ((ASTParameter)n).isAnyZeroOrMoreParameters()) 69 { 70 hasAnyZeroOrMoreParameters = true; 71 } 72 } 73 else super.jjtAddChild(n, i); 74 } 75 public void setClassExpression(String expression) 76 { 77 classExpr = expression; 78 clazz = new ClassExpression(classExpr); 79 } 80 81 public void setNewExpression(String expr) 82 { 83 if (expr.startsWith("@")) annotation = new IdentifierExpression(expr); 84 } 85 86 public String getClassExpr() 87 { 88 return classExpr; 89 } 90 91 public ArrayList getAttributes() 92 { 93 return attributes; 94 } 95 96 public ArrayList getExceptions() 97 { 98 return exceptions; 99 } 100 101 public ArrayList getParameters() 102 { 103 return parameters; 104 } 105 106 public boolean isAnyParameters() 107 { 108 return anyParameters; 109 } 110 111 public boolean hasAnyZeroOrMoreParameters() 112 { 113 return hasAnyZeroOrMoreParameters; 114 } 115 116 public ClassExpression getClazz() 117 { 118 return clazz; 119 } 120 121 125 public IdentifierExpression getConstructorAnnotation() 126 { 127 return annotation; 128 } 129 } 130 | Popular Tags |