Package org.nuiton.jaxx.compiler.java
Class JavaMethod
- java.lang.Object
-
- org.nuiton.jaxx.compiler.java.JavaElement
-
- org.nuiton.jaxx.compiler.java.JavaMethod
-
- All Implemented Interfaces:
Comparable<JavaMethod>
public class JavaMethod extends JavaElement implements Comparable<JavaMethod>
Represents a method in a Java source file being generated for output.JavaMethodsare created and added to aJavaFile, which can then output Java source code. In addition to normal methods, aJavaMethodcan represent a constructor -- constructors should be named after their containing classes and have a return type ofnull.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classJavaMethod.MethodOrder
-
Field Summary
-
Fields inherited from class org.nuiton.jaxx.compiler.java.JavaElement
JavaElementComparator
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(JavaMethod o)JavaArgument[]getArguments()Returns a list of the method's arguments.StringgetBody()String[]getExceptions()Returns a list of exceptions the method can throw.static EnumSet<JavaMethod.MethodOrder>getMethodOrderScope(EnumSet<JavaMethod.MethodOrder> allConstants, int scope)StringgetReturnType()Returns the method's return type, as it would be represented in Java source code.static EnumMap<JavaMethod.MethodOrder,List<JavaMethod>>getSortedMethods(List<JavaMethod> methods)booleanisOverride()voidsetBody(String body)voidsetReturnType(String returnType)-
Methods inherited from class org.nuiton.jaxx.compiler.java.JavaElement
addAnnotation, getAnnotations, getModifiers, getModifiersText, getName, hasAnnotations, isAbstract, setModifiers, setName
-
-
-
-
Method Detail
-
getSortedMethods
public static EnumMap<JavaMethod.MethodOrder,List<JavaMethod>> getSortedMethods(List<JavaMethod> methods)
-
getMethodOrderScope
public static EnumSet<JavaMethod.MethodOrder> getMethodOrderScope(EnumSet<JavaMethod.MethodOrder> allConstants, int scope)
-
getReturnType
public String getReturnType()
Returns the method's return type, as it would be represented in Java source code.- Returns:
- the method's return type
-
getArguments
public JavaArgument[] getArguments()
Returns a list of the method's arguments.- Returns:
- the method's arguments
-
getExceptions
public String[] getExceptions()
Returns a list of exceptions the method can throw.- Returns:
- the method's exceptions
-
isOverride
public boolean isOverride()
-
getBody
public String getBody()
-
setBody
public void setBody(String body)
-
compareTo
public int compareTo(JavaMethod o)
- Specified by:
compareToin interfaceComparable<JavaMethod>
-
setReturnType
public void setReturnType(String returnType)
-
-