|
|||||||||||
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.java.JavaMethod
A class generating a Java method declaration.
Field Summary | |
static int |
ABSTRACT
The abstract modifier constant. |
static int |
FINAL
The final modifier constant. |
static int |
NATIVE
The abstract 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. |
static int |
SYNCHRONIZED
The synchronized modifier constant. |
Constructor Summary | |
JavaMethod(int modifiers,
java.lang.String name,
java.lang.String args,
java.lang.String returnType)
Creates a new method with the specified arguments. |
|
JavaMethod(java.lang.String name)
Creates a new method with the specified name. |
|
JavaMethod(java.lang.String name,
java.lang.String args)
Creates a new method with the specified name and arguments. |
|
JavaMethod(java.lang.String name,
java.lang.String args,
java.lang.String returnType)
Creates a new method with the specified arguments. |
Method Summary | |
void |
addCode(java.lang.String codeLines)
Adds one or more lines of actual code. |
void |
addComment(JavaComment comment)
Sets a comment for this method. |
void |
addThrows(java.lang.String className)
Adds a class to the list of exceptions thrown. |
boolean |
canPrintCode()
Checks if the method source code can the printed. |
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. |
void |
setPrintCode(boolean value)
Sets the print code flag. |
Methods inherited from class net.percederberg.grammatica.code.CodeElement |
compareTo |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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 SYNCHRONIZED
public static final int NATIVE
public static final int STRICTFP
Constructor Detail |
public JavaMethod(java.lang.String name)
name
- the method namepublic JavaMethod(java.lang.String name, java.lang.String args)
name
- the method nameargs
- the argument list, excluding parenthesispublic JavaMethod(java.lang.String name, java.lang.String args, java.lang.String returnType)
name
- the method nameargs
- the argument list, excluding parenthesisreturnType
- the return typepublic JavaMethod(int modifiers, java.lang.String name, java.lang.String args, java.lang.String returnType)
modifiers
- the modifier flags to usename
- the method nameargs
- the argument list, excluding parenthesisreturnType
- the return typeMethod Detail |
public void addThrows(java.lang.String className)
className
- the name of the exception thrownpublic void addCode(java.lang.String codeLines)
codeLines
- the lines of Java code to addpublic void addComment(JavaComment comment)
comment
- the new method commentpublic int category()
category
in class CodeElement
public boolean canPrintCode()
public void setPrintCode(boolean value)
value
- the new print code flag valuepublic 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 level
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |