1 15 16 package javassist.compiler.ast; 17 18 import javassist.compiler.CompileError; 19 20 public class MethodDecl extends ASTList { 21 public static final String initName = "<init>"; 22 23 public MethodDecl(ASTree _head, ASTList _tail) { 24 super(_head, _tail); 25 } 26 27 public boolean isConstructor() { 28 Symbol sym = getReturn().getVariable(); 29 return sym != null && initName.equals(sym.get()); 30 } 31 32 public ASTList getModifiers() { return (ASTList)getLeft(); } 33 34 public Declarator getReturn() { return (Declarator)tail().head(); } 35 36 public ASTList getParams() { return (ASTList)sublist(2).head(); } 37 38 public ASTList getThrows() { return (ASTList)sublist(3).head(); } 39 40 public Stmnt getBody() { return (Stmnt)sublist(4).head(); } 41 42 public void accept(Visitor v) throws CompileError { 43 v.atMethodDecl(this); 44 } 45 } 46 | Popular Tags |