Package org.exolab.javasource
Class JEnumConstant
java.lang.Object
org.exolab.javasource.JAnnotatedElementHelper
org.exolab.javasource.JEnumConstant
- All Implemented Interfaces:
JAnnotatedElement
,JMember
Describes the definition of a enum constant.
- Version:
- $Revision$ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
- Author:
- Andrew Fawcett
-
Constructor Summary
ConstructorsConstructorDescriptionJEnumConstant
(String name) Constructs a JEnumConstant with a given name and no initialization arguements.JEnumConstant
(String name, String[] arguments) Constructs a JEnumConstant with a given name and initialization arguments. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given JMethod to this JEnumConstant.void
Adds the given JMethod to this JEnumConstant.void
addMethods
(JMethod[] jMethods) Adds the given array of JMethods to this JEnumConstant.int
Returns the amount of arguments.String[]
Returns the arguments used by this constant.Returns the JavaDoc comment describing this JEnumConstant.getMethod
(int index) Returns the JMethod located at the specified index.Returns the first occurance of the method with the given name, starting from the specified index.int
JMethod[]
Returns an array of all the JMethods of this JMethodReturns the modifiers for this JEnumConstant.getName()
Returns the name of this JEnumConstant.void
print
(JSourceWriter jsw) prints this enum constant.void
setArguments
(String[] args) Sets the arguments specified by this constant.void
setComment
(String comment) Sets the JavaDoc comment describing this JEnumConstant.void
setComment
(JDocComment comment) Sets the JavaDoc comment describing this JEnumConstant.void
Sets the name of this JEnumConstant.Methods inherited from class org.exolab.javasource.JAnnotatedElementHelper
addAnnotation, getAnnotation, getAnnotations, hasAnnotations, isAnnotationPresent, printAnnotations, removeAnnotation
-
Constructor Details
-
JEnumConstant
Constructs a JEnumConstant with a given name and no initialization arguements.- Parameters:
name
- Name of the constant.
-
JEnumConstant
-
-
Method Details
-
getModifiers
Returns the modifiers for this JEnumConstant.- Specified by:
getModifiers
in interfaceJMember
- Returns:
- The modifiers for this JEnumConstant.
-
setArguments
Sets the arguments specified by this constant.- Parameters:
args
- Initialization arguments for this constant.
-
getArguments
Returns the arguments used by this constant.- Returns:
- The arguments used by this constant.
-
getArgumentCount
public int getArgumentCount()Returns the amount of arguments.- Returns:
- The amount of arguments.
-
addMethod
Adds the given JMethod to this JEnumConstant.- Parameters:
jMethod
- The JMethod to add.
-
addMethod
Adds the given JMethod to this JEnumConstant.- Parameters:
jMethod
- The JMethod to add.importReturnType
- True if we add the importReturnType to the class import lists. It could be useful to set it to false when all types are fully qualified.
-
addMethods
Adds the given array of JMethods to this JEnumConstant.- Parameters:
jMethods
- The array of JMethod to add.
-
getMethods
Returns an array of all the JMethods of this JMethod- Returns:
- An array of all the JMethods of this JMethod.
-
getMethodCount
public int getMethodCount() -
getMethod
Returns the first occurance of the method with the given name, starting from the specified index.- Parameters:
name
- The name of the method to look for.startIndex
- The starting index to begin the search.- Returns:
- The method if found, otherwise null.
-
getMethod
Returns the JMethod located at the specified index.- Parameters:
index
- The index of the JMethod to return.- Returns:
- The JMethod.
-
setName
Sets the name of this JEnumConstant.- Parameters:
name
- The name of this JEnumConstant.
-
getName
-
setComment
Sets the JavaDoc comment describing this JEnumConstant.- Parameters:
comment
- The JavaDoc comment for this JEnumConstant.
-
setComment
Sets the JavaDoc comment describing this JEnumConstant.- Parameters:
comment
- The JavaDoc comment for this JEnumConstant.
-
getComment
Returns the JavaDoc comment describing this JEnumConstant.- Returns:
- The JavaDoc comment describing this JEnumConstant, or null if none has been set.
-
print
prints this enum constant.- Parameters:
jsw
- The JSourceWriter to print to. Must not be null.
-