Package jaxx.compiler.java
Class JavaMethod
java.lang.Object
jaxx.compiler.java.JavaElement
jaxx.compiler.java.JavaMethod
- All Implemented Interfaces:
java.lang.Comparable<JavaMethod>
public class JavaMethod extends JavaElement implements java.lang.Comparable<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
Nested Classes Modifier and Type Class Description static classJavaMethod.MethodOrder -
Field Summary
Fields inherited from class jaxx.compiler.java.JavaElement
JavaElementComparator -
Method Summary
Modifier and Type Method Description intcompareTo(JavaMethod o)JavaArgument[]getArguments()Returns a list of the method's arguments.java.lang.StringgetBody()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)java.lang.StringgetReturnType()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)booleanisOverride()voidsetBody(java.lang.String body)voidsetReturnType(java.lang.String returnType)Methods inherited from class jaxx.compiler.java.JavaElement
addAnnotation, getAnnotations, getModifiers, getModifiersText, getName, hasAnnotations, setModifiers, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
getReturnType
public java.lang.String getReturnType()Returns the method's return type, as it would be represented in Java source code.- Returns:
- the method's return type
-
getArguments
Returns a list of the method's arguments.- Returns:
- the method's arguments
-
getExceptions
public java.lang.String[] getExceptions()Returns a list of exceptions the method can throw.- Returns:
- the method's exceptions
-
isOverride
public boolean isOverride() -
getBody
public java.lang.String getBody() -
setBody
public void setBody(java.lang.String body) -
compareTo
- Specified by:
compareToin interfacejava.lang.Comparable<JavaMethod>
-
setReturnType
public void setReturnType(java.lang.String returnType) -
getSortedMethods
public static java.util.EnumMap<JavaMethod.MethodOrder,java.util.List<JavaMethod>> getSortedMethods(java.util.List<JavaMethod> methods) -
getMethodOrderScope
public static java.util.EnumSet<JavaMethod.MethodOrder> getMethodOrderScope(java.util.EnumSet<JavaMethod.MethodOrder> allConstants, int scope)
-