net.sourceforge.pmd.lang.java.ast.ASTInitializer Maven / Gradle / Ivy
The newest version!
/**
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.java.ast;
/**
* A class or instance initializer. Don't confuse with an initializer of a {@link ASTVariableDeclarator local variable}
* which is a {@link ASTExpression expression}.
*
*
*
* Initializer ::= "static"? {@link ASTBlock Block}
*
*
*
*/
public final class ASTInitializer extends AbstractJavaNode implements ASTBodyDeclaration {
private boolean isStatic;
ASTInitializer(int id) {
super(id);
}
@Override
protected R acceptVisitor(JavaVisitor super P, ? extends R> visitor, P data) {
return visitor.visit(this, data);
}
public boolean isStatic() {
return isStatic;
}
void setStatic() {
isStatic = true;
}
/**
* Returns the body of this initializer.
*/
public ASTBlock getBody() {
return (ASTBlock) getChild(0);
}
}