- java.lang.Object
-
- com.sun.codemodel.JModule
-
- All Implemented Interfaces:
JAnnotatable,JDocCommentable,JGenerable
public class JModule extends Object implements JGenerable, JAnnotatable, JDocCommentable
Represents a Java module.- Author:
- Tomas Kraus
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void_exports(JPackage pkg)Adds a package to the list of Java module exports.void_exports(Collection<JPackage> pkgs, boolean addEmpty)Adds packages to the list of Java module exports.void_requires(boolean isPublic, boolean isStatic, String... names)Adds all modules to the list of Java module requirements.void_requires(String name)Adds a module to the list of Java module requirements withoutpublicandstaticmodifiers.void_requires(String... names)Adds all modules to the list of Java module requirements withoutpublicandstaticmodifiers.void_requires(String name, boolean isPublic, boolean isStatic)Adds a module to the list of Java module requirements.JAnnotationUseannotate(JClass clazz)Adds an annotation to this program element.JAnnotationUseannotate(Class<? extends Annotation> clazz)Adds an annotation to this program element.<W extends JAnnotationWriter<? extends Annotation>>
Wannotate2(Class<W> clazz)Adds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.Collection<JAnnotationUse>annotations()Read-only live view of all annotations on thisvoidgenerate(JFormatter f)Print source code of Java Module declaration.JDocCommentjavadoc()Creates, if necessary, and returns the class javadoc for this JModuleStringname()Gets the name of this module.booleanremoveAnnotation(JAnnotationUse annotation)Removes annotation from this program element.
-
-
-
Method Detail
-
name
public String name()
Gets the name of this module.- Returns:
- name of this module.
-
_exports
public void _exports(JPackage pkg)
Adds a package to the list of Java module exports. The package name shall not benullor emptyString.- Parameters:
pkg- Java package to be exported.
-
_exports
public void _exports(Collection<JPackage> pkgs, boolean addEmpty)
Adds packages to the list of Java module exports.- Parameters:
pkgs- Collection of packages to be added.addEmpty- Adds also packages without any classes whentrue.
-
_requires
public void _requires(String name, boolean isPublic, boolean isStatic)
Adds a module to the list of Java module requirements. The module name shall not benullor emptyString.- Parameters:
name- Name of required Java module.isPublic- Usepublicmodifier.isStatic- Usestaticmodifier.
-
_requires
public void _requires(String name)
Adds a module to the list of Java module requirements withoutpublicandstaticmodifiers. The module name shall not benullor emptyString.- Parameters:
name- Name of required Java module.
-
_requires
public void _requires(boolean isPublic, boolean isStatic, String... names)Adds all modules to the list of Java module requirements. The module name shall not benullor emptyString.- Parameters:
names- Names of required Java module.isPublic- Usepublicmodifier.isStatic- Usestaticmodifier.
-
_requires
public void _requires(String... names)
Adds all modules to the list of Java module requirements withoutpublicandstaticmodifiers.- Parameters:
names- Names of required Java module.
-
annotate
public JAnnotationUse annotate(JClass clazz)
Description copied from interface:JAnnotatableAdds an annotation to this program element.- Specified by:
annotatein interfaceJAnnotatable- Parameters:
clazz- The annotation class to annotate the program element with
-
annotate
public JAnnotationUse annotate(Class<? extends Annotation> clazz)
Description copied from interface:JAnnotatableAdds an annotation to this program element.- Specified by:
annotatein interfaceJAnnotatable- Parameters:
clazz- The annotation class to annotate the program element with
-
removeAnnotation
public boolean removeAnnotation(JAnnotationUse annotation)
Description copied from interface:JAnnotatableRemoves annotation from this program element.- Specified by:
removeAnnotationin interfaceJAnnotatable- Parameters:
annotation- The annotation to be removed from the program element
-
annotations
public Collection<JAnnotationUse> annotations()
Description copied from interface:JAnnotatableRead-only live view of all annotations on this- Specified by:
annotationsin interfaceJAnnotatable- Returns:
- Can be empty but never null.
-
annotate2
public <W extends JAnnotationWriter<? extends Annotation>> W annotate2(Class<W> clazz)
Description copied from interface:JAnnotatableAdds an annotation to this program element and returns a type-safe writer to fill in the values of such annotations.- Specified by:
annotate2in interfaceJAnnotatable
-
javadoc
public JDocComment javadoc()
Creates, if necessary, and returns the class javadoc for this JModule- Specified by:
javadocin interfaceJDocCommentable- Returns:
- JDocComment containing javadocs for this class
-
generate
public void generate(JFormatter f)
Print source code of Java Module declaration.- Specified by:
generatein interfaceJGenerable- Parameters:
f- Java code formatter.
-
-