Class ASTSwitchStatement
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AbstractNode
-
- net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
-
- net.sourceforge.pmd.lang.java.ast.ASTSwitchStatement
-
- All Implemented Interfaces:
java.lang.Iterable<ASTSwitchLabel>
,net.sourceforge.pmd.lang.ast.Node
,JavaNode
,net.sourceforge.pmd.lang.symboltable.ScopedNode
public class ASTSwitchStatement extends AbstractJavaNode implements java.lang.Iterable<ASTSwitchLabel>
Represents aswitch
statement.SwitchStatement ::= "switch" "(" Expression ")" "{" ( SwitchLabel BlockStatement* )* "}"
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
parser
-
-
Constructor Summary
Constructors Constructor Description ASTSwitchStatement(int id)
ASTSwitchStatement(JavaParser p, int id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ASTExpression
getTestedExpression()
Gets the expression tested by this switch.boolean
hasDefaultCase()
Returns true if this switch has adefault
case.boolean
isExhaustiveEnumSwitch()
Returns true if this switch statement tests an expression having an enum type and all the constants of this type are covered by a switch case.java.util.Iterator<ASTSwitchLabel>
iterator()
java.lang.Object
jjtAccept(JavaParserVisitor visitor, java.lang.Object data)
Accept the visitor.-
Methods inherited from class net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
childrenAccept, comment, comment, getScope, getXPathNodeName, jjtClose, jjtOpen, setScope
-
Methods inherited from class net.sourceforge.pmd.lang.ast.AbstractNode
appendElement, findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, getXPathAttributesIterator, hasDecendantOfAnyType, hasDescendantMatchingXPath, hasDescendantOfAnyType, hasDescendantOfType, hasImageEqualTo, isFindBoundary, isSingleLine, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetFirstToken, jjtGetId, jjtGetLastToken, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetFirstToken, jjtSetLastToken, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData, testingOnlySetBeginColumn, testingOnlySetBeginLine, testingOnlySetEndColumn, testingOnlySetEndLine, toString
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getNthParent, getParentsOfType, getUserData, getXPathAttributesIterator, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData
-
-
-
-
Constructor Detail
-
ASTSwitchStatement
public ASTSwitchStatement(int id)
-
ASTSwitchStatement
public ASTSwitchStatement(JavaParser p, int id)
-
-
Method Detail
-
jjtAccept
public java.lang.Object jjtAccept(JavaParserVisitor visitor, java.lang.Object data)
Description copied from class:AbstractJavaNode
Accept the visitor. *- Specified by:
jjtAccept
in interfaceJavaNode
- Overrides:
jjtAccept
in classAbstractJavaNode
-
hasDefaultCase
public boolean hasDefaultCase()
Returns true if this switch has adefault
case.
-
getTestedExpression
public ASTExpression getTestedExpression()
Gets the expression tested by this switch. This is the expression between the parentheses.
-
isExhaustiveEnumSwitch
public boolean isExhaustiveEnumSwitch()
Returns true if this switch statement tests an expression having an enum type and all the constants of this type are covered by a switch case. Returns false if the type of the tested expression could not be resolved.
-
iterator
public java.util.Iterator<ASTSwitchLabel> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<ASTSwitchLabel>
-
-