net.sourceforge.pmd.lang.java.ast.ASTLabeledStatement Maven / Gradle / Ivy
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.ast;
/**
* A wrapper around a statement that assigns it a label.
*
*
*
* LabeledStatement ::= <IDENTIFIER> ":" {@link ASTStatement Statement}
*
*
*/
public final class ASTLabeledStatement extends AbstractStatement {
ASTLabeledStatement(int id) {
super(id);
}
@Override
protected R acceptVisitor(JavaVisitor super P, ? extends R> visitor, P data) {
return visitor.visit(this, data);
}
/**
* Returns the name of the label.
*/
public String getLabel() {
return getImage();
}
/**
* Returned the statement named by this label.
*/
public ASTStatement getStatement() {
return (ASTStatement) getChild(0);
}
}