All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.java.ast.ASTEnumBody Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
/**
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */

package net.sourceforge.pmd.lang.java.ast;

/**
 * Body of an {@linkplain ASTEnumDeclaration enum declaration}.
 *
 * 
 *
 * EnumBody ::= "{"
 *              [ {@link ASTEnumConstant EnumConstant} ( "," ( {@link ASTEnumConstant EnumConstant} )* ]
 *              [ "," ]
 *              [ ";" ( {@link ASTBodyDeclaration BodyDeclaration} )* ]
 *              "}"
 *
 * 
* * */ public final class ASTEnumBody extends ASTTypeBody { private boolean trailingComma; private boolean separatorSemi; ASTEnumBody(int id) { super(id); } @Override protected R acceptVisitor(JavaVisitor visitor, P data) { return visitor.visit(this, data); } void setTrailingComma() { this.trailingComma = true; } void setSeparatorSemi() { this.separatorSemi = true; } /** * Returns true if the last enum constant has a trailing comma. * For example: *
{@code
     * enum Foo { A, B, C, }
     * enum Bar { , }
     * }
*/ public boolean hasTrailingComma() { return trailingComma; } /** * Returns true if the last enum constant has a trailing semi-colon. * This semi is not optional when the enum has other members. * For example: *
{@code
     * enum Foo {
     *   A(2);
     *
     *   Foo(int i) {...}
     * }
     *
     * enum Bar { A; }
     * enum Baz { ; }
     * }
*/ public boolean hasSeparatorSemi() { return separatorSemi; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy