Class ASTSwitchStatement
- java.lang.Object
-
- net.sourceforge.pmd.lang.ast.AbstractNode
-
- net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode<JavaNode>
-
- net.sourceforge.pmd.lang.java.ast.AbstractJavaNode
-
- net.sourceforge.pmd.lang.java.ast.ASTSwitchStatement
-
- All Implemented Interfaces:
Iterable<ASTSwitchLabel>,net.sourceforge.pmd.lang.ast.Node,JavaNode,net.sourceforge.pmd.lang.symboltable.ScopedNode
public class ASTSwitchStatement extends AbstractJavaNode implements Iterable<ASTSwitchLabel>
Represents aswitchstatement.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)Deprecated.ASTSwitchStatement(JavaParser p, int id)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ASTExpressiongetTestedExpression()Gets the expression tested by this switch.booleanhasDefaultCase()Returns true if this switch has adefaultcase.booleanisExhaustiveEnumSwitch()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.Iterator<ASTSwitchLabel>iterator()ObjectjjtAccept(JavaParserVisitor visitor, Object data)Calls back the visitor's visit method corresponding to the runtime type of this Node.-
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.impl.javacc.AbstractJjtreeNode
children, getChild, getParent
-
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, getIndexInParent, getNthParent, getNumChildren, 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 class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaNode
children, getChild, getParent
-
Methods inherited from interface net.sourceforge.pmd.lang.ast.Node
findChildNodesWithXPath, findChildrenOfType, findDescendantsOfType, findDescendantsOfType, findDescendantsOfType, getAsDocument, getBeginColumn, getBeginLine, getDataFlowNode, getEndColumn, getEndLine, getFirstChildOfType, getFirstDescendantOfType, getFirstParentOfAnyType, getFirstParentOfType, getImage, getIndexInParent, getNthParent, getNumChildren, getParentsOfType, getUserData, getXPathAttributesIterator, hasDescendantMatchingXPath, hasDescendantOfType, hasImageEqualTo, isFindBoundary, jjtAddChild, jjtGetChild, jjtGetChildIndex, jjtGetId, jjtGetNumChildren, jjtGetParent, jjtSetChildIndex, jjtSetParent, remove, removeChildAtIndex, setDataFlowNode, setImage, setUserData
-
-
-
-
Constructor Detail
-
ASTSwitchStatement
@InternalApi @Deprecated public ASTSwitchStatement(int id)
Deprecated.
-
ASTSwitchStatement
@InternalApi @Deprecated public ASTSwitchStatement(JavaParser p, int id)
Deprecated.
-
-
Method Detail
-
jjtAccept
public Object jjtAccept(JavaParserVisitor visitor, Object data)
Description copied from interface:JavaNodeCalls back the visitor's visit method corresponding to the runtime type of this Node.- Specified by:
jjtAcceptin interfaceJavaNode- Overrides:
jjtAcceptin classAbstractJavaNode- Parameters:
visitor- Visitor to dispatchdata- Visit data
-
hasDefaultCase
public boolean hasDefaultCase()
Returns true if this switch has adefaultcase.
-
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 Iterator<ASTSwitchLabel> iterator()
- Specified by:
iteratorin interfaceIterable<ASTSwitchLabel>
-
-