|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.percederberg.grammatica.code.CodeElement | +--net.percederberg.grammatica.code.CodeElementContainer | +--net.percederberg.grammatica.code.java.JavaType | +--net.percederberg.grammatica.code.java.JavaClass
A class generating a Java class declaration.
Field Summary | |
static int |
ABSTRACT
The abstract modifier constant. |
static int |
FINAL
The final modifier constant. |
static int |
PACKAGE_LOCAL
The package local access modifier constant (i.e. no modifier). |
static int |
PRIVATE
The private access modifier constant. |
static int |
PROTECTED
The protected access modifier constant. |
static int |
PUBLIC
The public access modifier constant. |
static int |
STATIC
The static modifier constant. |
static int |
STRICTFP
The strictfp modifier constant. |
Constructor Summary | |
JavaClass(int modifiers,
java.lang.String name)
Creates a new class code generator with the specified access modifier. |
|
JavaClass(int modifiers,
java.lang.String name,
java.lang.String extendClass)
Creates a new class code generator with the specified access modifier that extends the specified class. |
|
JavaClass(int modifiers,
java.lang.String name,
java.lang.String extendClass,
java.lang.String implementClass)
Creates a new class code generator with the specified access modifier that extends and implements the specified classes or interfaces. |
|
JavaClass(int modifiers,
java.lang.String name,
java.lang.String extendClass,
java.lang.String[] implementClasses)
Creates a new class code generator with the specified access modifier that extends and implements the specified classes or interfaces. |
|
JavaClass(java.lang.String name)
Creates a new class code generator with a public access modifier. |
Method Summary | |
void |
addClass(JavaClass member)
Adds an inner class to this class. |
void |
addComment(JavaComment comment)
Adds a comment to this type. |
void |
addConstructor(JavaConstructor member)
Adds a constructor to the class. |
void |
addMethod(JavaMethod member)
Adds a method to the class. |
void |
addVariable(JavaVariable member)
Adds a variable to the class. |
int |
category()
Returns a numeric category number for the code element. |
void |
print(java.io.PrintWriter out,
CodeStyle style,
int indent)
Prints the code element to the specified output stream. |
protected void |
print(java.io.PrintWriter out,
CodeStyle style,
int indent,
java.lang.String type)
Prints the type to the specified stream. |
protected void |
printSeparator(java.io.PrintWriter out,
CodeStyle style,
CodeElement prev,
CodeElement next)
Prints the lines separating two elements. |
java.lang.String |
toString()
Returns the type name. |
Methods inherited from class net.percederberg.grammatica.code.CodeElementContainer |
addElement, printContents |
Methods inherited from class net.percederberg.grammatica.code.CodeElement |
compareTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int PUBLIC
public static final int PROTECTED
public static final int PACKAGE_LOCAL
public static final int PRIVATE
public static final int STATIC
public static final int ABSTRACT
public static final int FINAL
public static final int STRICTFP
Constructor Detail |
public JavaClass(java.lang.String name)
name
- the class namepublic JavaClass(int modifiers, java.lang.String name)
modifiers
- the modifier constant flagsname
- the class namepublic JavaClass(int modifiers, java.lang.String name, java.lang.String extendClass)
modifiers
- the modifier constant flagsname
- the class nameextendClass
- the class to extendpublic JavaClass(int modifiers, java.lang.String name, java.lang.String extendClass, java.lang.String implementClass)
modifiers
- the modifier constant flagsname
- the class nameextendClass
- the class to extendimplementClass
- the class to implementpublic JavaClass(int modifiers, java.lang.String name, java.lang.String extendClass, java.lang.String[] implementClasses)
modifiers
- the modifier constant flagsname
- the class nameextendClass
- the class to extendimplementClasses
- the classes to implementMethod Detail |
public void addClass(JavaClass member)
member
- the member to addpublic void addConstructor(JavaConstructor member)
member
- the member to addpublic void addMethod(JavaMethod member)
member
- the member to addpublic void addVariable(JavaVariable member)
member
- the member to addpublic int category()
category
in class CodeElement
public void print(java.io.PrintWriter out, CodeStyle style, int indent)
print
in class CodeElement
out
- the output streamstyle
- the code style to useindent
- the indentation levelpublic java.lang.String toString()
toString
in class java.lang.Object
public void addComment(JavaComment comment)
comment
- the new type commentprotected void print(java.io.PrintWriter out, CodeStyle style, int indent, java.lang.String type)
out
- the output streamstyle
- the code style to useindent
- the indentation leveltype
- the type name (i.e. "class" or "interface")protected void printSeparator(java.io.PrintWriter out, CodeStyle style, CodeElement prev, CodeElement next)
printSeparator
in class CodeElementContainer
out
- the output streamstyle
- the code style to useprev
- the previous element, or null if firstnext
- the next element, or null if last
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |