|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nuiton.guix.generator.JavaMethod
public class JavaMethod
Represents a method in a Java source file being generated for output. JavaMethods are created
and added to a JavaFile, which can then output Java source code. In addition to normal methods, a
JavaMethod can represent a constructor -- constructors should be named after their containing
classes and have a return type of null.
| Nested Class Summary | |
|---|---|
static class |
JavaMethod.MethodOrder
|
| Field Summary | |
|---|---|
static java.util.Comparator<JavaMethod> |
COMPARATOR
|
| Constructor Summary | |
|---|---|
JavaMethod(int modifiers,
java.lang.String returnType,
java.lang.String name,
JavaArgument[] arguments,
java.lang.String[] exceptions,
java.lang.String bodyCode,
java.lang.String javaDoc)
Constructs a new JavaMethod containing the specified body code. |
|
| Method Summary | |
|---|---|
void |
appendBodyCode(java.lang.String extraCode,
java.lang.String lineSeparator)
Appends additional code to the method's body. |
int |
compareTo(JavaMethod o)
|
JavaArgument[] |
getArguments()
Returns a list of the method's arguments. |
java.lang.String |
getBodyCode()
Returns the Java source code for the method's body. |
java.lang.String[] |
getExceptions()
Returns a list of exceptions the method can throw. |
static java.util.EnumSet<JavaMethod.MethodOrder> |
getMethodOrderScope(java.util.EnumSet<JavaMethod.MethodOrder> allConstants,
int scope)
|
int |
getModifiers()
Returns a bit mask describing the modifier keywords which should appear as part of this method's declaration. |
java.lang.String |
getName()
Returns the method's name. |
java.lang.String |
getReturnType()
Returns the method's return type, as it would be represented in Java source code. |
static java.util.EnumMap<JavaMethod.MethodOrder,java.util.List<JavaMethod>> |
getSortedMethods(java.util.List<JavaMethod> methods)
|
void |
setBodyCode(java.lang.String bodyCode)
|
java.lang.String |
toString(java.lang.String lineSeparator)
Returns the Java source code for this method. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.util.Comparator<JavaMethod> COMPARATOR
| Constructor Detail |
|---|
public JavaMethod(int modifiers,
java.lang.String returnType,
java.lang.String name,
JavaArgument[] arguments,
java.lang.String[] exceptions,
java.lang.String bodyCode,
java.lang.String javaDoc)
JavaMethod containing the specified body code. The modifiers parameter
is a bit mask of the constants from Modifier, and the returnType and
exceptions of the method should be represented as they would appear in Java source code (null
for a constructor). The method body is initially empty.
modifiers - the modifier keywords that should appear as part of the method's declarationreturnType - the return type of the method as it would appear in Java source codename - the method's namearguments - the method's argumentsexceptions - a list of exceptions the methods can throw, as they would be represented in Java source codebodyCode - Java source code which should appear in the method body| Method Detail |
|---|
public int getModifiers()
java.lang.reflect.Modifier for more information on decoding this
field.
public java.lang.String getReturnType()
public java.lang.String getName()
public JavaArgument[] getArguments()
public java.lang.String[] getExceptions()
public java.lang.String getBodyCode()
public void setBodyCode(java.lang.String bodyCode)
public void appendBodyCode(java.lang.String extraCode,
java.lang.String lineSeparator)
extraCode - Java source code to append to the method's bodylineSeparator - line separatorpublic java.lang.String toString(java.lang.String lineSeparator)
lineSeparator - line separator
public int compareTo(JavaMethod o)
compareTo in interface java.lang.Comparable<JavaMethod>public static java.util.EnumMap<JavaMethod.MethodOrder,java.util.List<JavaMethod>> getSortedMethods(java.util.List<JavaMethod> methods)
public static java.util.EnumSet<JavaMethod.MethodOrder> getMethodOrderScope(java.util.EnumSet<JavaMethod.MethodOrder> allConstants,
int scope)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||