public final class GeneratedPackage extends Object implements Declaration, Generable, ClassContainer, Annotable, Comparable<GeneratedPackage>, Documentable
Modifier and Type | Method and Description |
---|---|
GeneratedClass |
_annotationTypeDeclaration(String name)
Add an annotationType Declaration to this package
|
GeneratedClass |
_class(int mods,
String name)
Add a class to this package.
|
GeneratedClass |
_class(int mods,
String name,
boolean isInterface)
Deprecated.
|
GeneratedClass |
_class(int modifiers,
String name,
Class<?>[] _implements)
Adds a public class to this package.
|
GeneratedClass |
_class(int modifiers,
String name,
Class<?> _extends,
Class<?>[] _implements)
Adds a public class to this package.
|
GeneratedClass |
_class(int modifiers,
String name,
GeneratedClass _extends,
Class<?>[] _implements)
Adds a public class to this package.
|
GeneratedClass |
_class(int mods,
String name,
GeneratedClassType classTypeVal)
Creates a new class/enum/interface/annotation.
|
GeneratedClass |
_class(int modifiers,
String name,
TypeReference _extends)
Adds a public class to this package.
|
GeneratedClass |
_class(String name)
Adds a public class to this package.
|
GeneratedClass |
_class(String name,
Class<?> _extends)
Adds a public class to this package.
|
GeneratedClass |
_class(String name,
Class<?>[] _implements)
Adds a public class to this package.
|
GeneratedClass |
_class(String name,
Class<?> _extends,
Class<?>[] _implements)
Adds a public class to this package.
|
GeneratedClass |
_class(String name,
GeneratedClass _extends,
Class<?>[] _implements)
Adds a public class to this package.
|
GeneratedClass |
_class(String name,
TypeReference _extends)
Adds a public class to this package.
|
GeneratedClass |
_class(String name,
TypeReference _extends,
Class<?>[] _implements)
Adds a public class to this package.
|
GeneratedClass |
_enum(String name)
Add a public enum to this package
|
GeneratedClass |
_getClass(String name)
Gets a reference to the already created
GeneratedClass . |
GeneratedClass |
_interface(int mods,
String name)
Add an interface to this package.
|
GeneratedClass |
_interface(String name)
Adds a public interface to this package.
|
ResourceFile |
addResourceFile(ResourceFile rsrc)
Adds a new resource file to this package.
|
GeneratedAnnotationUse |
annotate(Class<? extends Annotation> clazz)
Adds an annotation to this program element.
|
GeneratedAnnotationUse |
annotate(TypeReference clazz)
Adds an annotation to this program element.
|
<W extends AnnotationWriter> |
annotate2(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<GeneratedAnnotationUse> |
annotations()
Read-only live view of all annotations on this
Annotable |
Iterator<GeneratedClass> |
classes()
Returns an iterator that walks the top-level classes defined in this
package.
|
int |
compareTo(GeneratedPackage that)
Order is based on the lexicological order of the package name.
|
void |
declare(Formatter f) |
void |
generate(Formatter f) |
GeneratedPackage |
getPackage()
Gets the nearest package parent.
|
boolean |
hasResourceFile(String name)
Checks if a resource of the given name exists.
|
boolean |
isClass()
Returns true if the container is a class.
|
boolean |
isDefined(String classLocalName)
Checks if a given name is already defined as a class/interface
|
boolean |
isPackage()
Returns true if the container is a package.
|
boolean |
isUnnamed()
Checks if this package is the root, unnamed package.
|
GeneratedJavaDocComment |
javadoc()
Creates, if necessary, and returns the package javadoc for this
DefinedClass.
|
String |
name()
Get the name of this package
|
CodeModel |
owner()
Return the code model root object being used to create this package.
|
GeneratedPackage |
parent()
Gets the parent package, or null if this class is the root package.
|
ClassContainer |
parentContainer()
Parent ClassContainer.
|
Iterator<ResourceFile> |
propertyFiles()
Iterates all resource files in this package.
|
TypeReference |
ref(String name)
Reference a class within this package.
|
void |
remove(TypeReference c)
Removes a class from this package.
|
GeneratedPackage |
subPackage(String pkg)
Gets a reference to a sub package of this package.
|
public ClassContainer parentContainer()
ClassContainer
parentContainer
in interface ClassContainer
public GeneratedPackage parent()
public boolean isClass()
ClassContainer
isClass
in interface ClassContainer
public boolean isPackage()
ClassContainer
isPackage
in interface ClassContainer
public GeneratedPackage getPackage()
ClassContainer
getPackage
in interface ClassContainer
public GeneratedClass _class(int mods, String name)
_class
in interface ClassContainer
mods
- Modifiers for this class declarationname
- Name of class to be added to this packageClassAlreadyExistsException
- When the specified class/interface was already created.public GeneratedClass _class(int mods, String name, boolean isInterface) throws ClassAlreadyExistsException
_class
in interface ClassContainer
ClassAlreadyExistsException
public GeneratedClass _class(int mods, String name, GeneratedClassType classTypeVal) throws ClassAlreadyExistsException
ClassContainer
_class
in interface ClassContainer
ClassAlreadyExistsException
public GeneratedClass _class(String name)
_class
in interface ClassContainer
public GeneratedClass _class(String name, TypeReference _extends)
public GeneratedClass _class(int modifiers, String name, TypeReference _extends)
public GeneratedClass _class(String name, Class<?> _extends)
public GeneratedClass _class(String name, Class<?> _extends, Class<?>[] _implements)
public GeneratedClass _class(int modifiers, String name, Class<?> _extends, Class<?>[] _implements)
public GeneratedClass _class(String name, GeneratedClass _extends, Class<?>[] _implements)
public GeneratedClass _class(String name, TypeReference _extends, Class<?>[] _implements)
public GeneratedClass _class(int modifiers, String name, GeneratedClass _extends, Class<?>[] _implements)
public GeneratedClass _class(String name, Class<?>[] _implements)
public GeneratedClass _class(int modifiers, String name, Class<?>[] _implements)
public GeneratedClass _getClass(String name)
GeneratedClass
.public int compareTo(GeneratedPackage that)
compareTo
in interface Comparable<GeneratedPackage>
public GeneratedClass _interface(int mods, String name)
_interface
in interface ClassContainer
mods
- Modifiers for this interface declarationname
- Name of interface to be added to this packagepublic GeneratedClass _interface(String name) throws ClassAlreadyExistsException
_interface
in interface ClassContainer
ClassAlreadyExistsException
- When the specified class/interface was already created.public GeneratedClass _annotationTypeDeclaration(String name) throws ClassAlreadyExistsException
_annotationTypeDeclaration
in interface ClassContainer
name
- Name of the annotation Type declaration to be added to this packageClassAlreadyExistsException
- When the specified class/interface was already created.public GeneratedClass _enum(String name) throws ClassAlreadyExistsException
_enum
in interface ClassContainer
name
- Name of the enum to be added to this packageClassAlreadyExistsException
- When the specified class/interface was already created.public ResourceFile addResourceFile(ResourceFile rsrc)
public boolean hasResourceFile(String name)
public Iterator<ResourceFile> propertyFiles()
public GeneratedJavaDocComment javadoc()
javadoc
in interface Documentable
public void remove(TypeReference c)
public TypeReference ref(String name) throws ClassNotFoundException
ClassNotFoundException
public GeneratedPackage subPackage(String pkg)
public Iterator<GeneratedClass> classes()
classes
in interface ClassContainer
public boolean isDefined(String classLocalName)
public final boolean isUnnamed()
public String name()
"java.lang"
public final CodeModel owner()
owner
in interface ClassContainer
public GeneratedAnnotationUse annotate(TypeReference clazz)
Annotable
public GeneratedAnnotationUse annotate(Class<? extends Annotation> clazz)
Annotable
public <W extends AnnotationWriter> W annotate2(Class<W> clazz)
Annotable
public Collection<GeneratedAnnotationUse> annotations()
Annotable
Annotable
annotations
in interface Annotable
public void declare(Formatter f)
declare
in interface Declaration
Copyright © 2010–2015 MuleSoft, Inc.. All rights reserved.