View Javadoc
1 /* Generated By:JJTree: Do not edit this line. ASTVariableDeclaratorId.java */ 2 3 package net.sourceforge.pmd.ast; 4 5 public class ASTVariableDeclaratorId extends SimpleNode { 6 public ASTVariableDeclaratorId(int id) { 7 super(id); 8 } 9 10 public ASTVariableDeclaratorId(JavaParser p, int id) { 11 super(p, id); 12 } 13 14 /*** Accept the visitor. **/ 15 public Object jjtAccept(JavaParserVisitor visitor, Object data) { 16 return visitor.visit(this, data); 17 } 18 19 public boolean isExceptionBlockParameter() { 20 return jjtGetParent().jjtGetParent() instanceof ASTTryStatement; 21 } 22 23 public SimpleNode getTypeNameNode() { 24 if (jjtGetParent().jjtGetParent() instanceof ASTLocalVariableDeclaration) { 25 return findTypeNameNode(jjtGetParent().jjtGetParent()); 26 } else if (jjtGetParent() instanceof ASTFormalParameter) { 27 return findTypeNameNode(jjtGetParent()); 28 } else if (jjtGetParent().jjtGetParent() instanceof ASTFieldDeclaration) { 29 return findTypeNameNode(jjtGetParent().jjtGetParent()); 30 } 31 throw new RuntimeException("Don't know how to get the type for anything other than a ASTLocalVariableDeclaration/ASTFormalParameterASTFieldDeclaration"); 32 } 33 34 public void dump(String prefix) { 35 System.out.println(toString(prefix) + ":" + getImage()); 36 dumpChildren(prefix); 37 } 38 39 private SimpleNode findTypeNameNode(Node node) { 40 ASTType typeNode = (ASTType) node.jjtGetChild(0); 41 return (SimpleNode) typeNode.jjtGetChild(0); 42 } 43 44 45 }

This page was automatically generated by Maven