1 22 23 package org.jboss.aop.pointcut.ast; 24 25 import java.util.ArrayList ; 26 27 public class ASTMethod extends SimpleNode 28 { 29 public ASTMethod(int id) 30 { 31 super(id); 32 } 33 34 public ASTMethod(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 52 String returnTypeExpr; 53 ClassExpression returnType; 54 String classExpr; 55 ClassExpression clazz; 56 String methodExpr; 57 IdentifierExpression methodIdentifier; 58 boolean anyParameters = false; 59 boolean hasAnyZeroOrMoreParameters = false; 60 ArrayList parameters = new ArrayList (); 61 ArrayList attributes = new ArrayList (); 62 ArrayList exceptions = new ArrayList (); 63 64 public void jjtAddChild(Node n, int i) 65 { 66 if (n instanceof ASTAttribute) attributes.add(n); 67 else if (n instanceof ASTException) exceptions.add(n); 68 else if (n instanceof ASTAllParameter) anyParameters = true; 69 else if (n instanceof ASTParameter && !anyParameters) 70 { 71 parameters.add(0, n); 72 if (!hasAnyZeroOrMoreParameters && ((ASTParameter)n).isAnyZeroOrMoreParameters()) 73 { 74 hasAnyZeroOrMoreParameters = true; 75 } 76 } 77 else super.jjtAddChild(n, i); 78 } 79 public void setMethodExpression(String expression) 80 { 81 methodExpr = expression; 82 methodIdentifier = new IdentifierExpression(expression); 83 } 84 85 public void setReturnTypeExpression(String exp) 86 { 87 returnTypeExpr = exp; 88 returnType = new ClassExpression(exp); 89 } 90 91 public void setClassExpression(String exp) 92 { 93 classExpr = exp; 94 clazz = new ClassExpression(exp); 95 } 96 97 public String getReturnTypeExpression() 98 { 99 return returnTypeExpr; 100 } 101 102 public String getClassExpr() 103 { 104 return classExpr; 105 } 106 107 public String getMethodExpr() 108 { 109 return methodExpr; 110 } 111 112 public boolean isAnyParameters() 113 { 114 return anyParameters; 115 } 116 117 public boolean hasAnyZeroOrMoreParameters() 118 { 119 return hasAnyZeroOrMoreParameters; 120 } 121 122 public ArrayList getParameters() 123 { 124 return parameters; 125 } 126 127 public ArrayList getExceptions() 128 { 129 return exceptions; 130 } 131 132 public ArrayList getAttributes() 133 { 134 return attributes; 135 } 136 137 public ClassExpression getReturnType() 138 { 139 return returnType; 140 } 141 142 public ClassExpression getClazz() 143 { 144 return clazz; 145 } 146 147 public IdentifierExpression getMethodIdentifier() 148 { 149 return methodIdentifier; 150 } 151 152 } 153 | Popular Tags |