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

net.sourceforge.pmd.lang.java.ast.ASTModuleDeclaration 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;

import net.sourceforge.pmd.lang.ast.NodeStream;

/**
 * A module declaration. This is found at the top-level of a
 * {@linkplain ASTCompilationUnit modular compilation unit}.
 *
 * 
 *
 * ModuleDeclaration ::= {@linkplain ASTModifierList AnnotationList} "open"?
 *                       "module" {@linkplain ASTModuleName ModuleName}
 *                       "{" {@linkplain ASTModuleDirective ModuleDirective}* "}"
 *
 * 
*/ public final class ASTModuleDeclaration extends AbstractJavaNode implements Annotatable { private boolean open; ASTModuleDeclaration(int id) { super(id); } @Override protected R acceptVisitor(JavaVisitor visitor, P data) { return visitor.visit(this, data); } /** * Returns the name of the declared module. Module names look * like package names, eg {@code java.base}. */ public String getName() { return firstChild(ASTModuleName.class).getName(); } /** * Returns a stream with all directives declared by the module. */ public NodeStream getDirectives() { return children(ASTModuleDirective.class); } void setOpen(boolean open) { this.open = open; } public boolean isOpen() { return open; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy