org.exolab.javasource
Class JEnumConstant

java.lang.Object
  extended by org.exolab.javasource.JAnnotatedElementHelper
      extended by org.exolab.javasource.JEnumConstant
All Implemented Interfaces:
JAnnotatedElement, JMember

public final class JEnumConstant
extends JAnnotatedElementHelper
implements JMember

Describes the definition of a enum constant.

Version:
$Revision: 7943 $ $Date: 2006-04-25 16:09:10 -0600 (Tue, 25 Apr 2006) $
Author:
Andrew Fawcett

Constructor Summary
JEnumConstant(java.lang.String name)
          Constructs a JEnumConstant with a given name and no initialization arguements.
JEnumConstant(java.lang.String name, java.lang.String[] arguments)
          Constructs a JEnumConstant with a given name and initialization arguments.
 
Method Summary
 void addMethod(JMethod jMethod)
          Adds the given JMethod to this JEnumConstant.
 void addMethod(JMethod jMethod, boolean importReturnType)
          Adds the given JMethod to this JEnumConstant.
 void addMethods(JMethod[] jMethods)
          Adds the given array of JMethods to this JEnumConstant.
 int getArgumentCount()
          Returns the amount of arguments.
 java.lang.String[] getArguments()
          Returns the arguments used by this constant.
 JDocComment getComment()
          Returns the JavaDoc comment describing this JEnumConstant.
 JMethod getMethod(int index)
          Returns the JMethod located at the specified index.
 JMethod getMethod(java.lang.String name, int startIndex)
          Returns the first occurance of the method with the given name, starting from the specified index.
 int getMethodCount()
           
 JMethod[] getMethods()
          Returns an array of all the JMethods of this JEnumConstant.
 JModifiers getModifiers()
          Returns the modifiers for this JEnumConstant.
 java.lang.String getName()
          Returns the name of this JEnumConstant.
 void print(JSourceWriter jsw)
          prints this enum constant.
 void setArguments(java.lang.String[] args)
          Sets the arguments specified by this constant.
 void setComment(JDocComment comment)
          Sets the JavaDoc comment describing this JEnumConstant.
 void setComment(java.lang.String comment)
          Sets the JavaDoc comment describing this JEnumConstant.
 void setName(java.lang.String name)
          Sets the name of this JEnumConstant.
 
Methods inherited from class org.exolab.javasource.JAnnotatedElementHelper
addAnnotation, getAnnotation, getAnnotations, hasAnnotations, isAnnotationPresent, printAnnotations, removeAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JEnumConstant

public JEnumConstant(java.lang.String name)
Constructs a JEnumConstant with a given name and no initialization arguements.

Parameters:
name - Name of the constant.

JEnumConstant

public JEnumConstant(java.lang.String name,
                     java.lang.String[] arguments)
Constructs a JEnumConstant with a given name and initialization arguments.

Parameters:
name - Name of the constant.
arguments - The initialization arguments provided.
Method Detail

getModifiers

public JModifiers getModifiers()
Returns the modifiers for this JEnumConstant.

Specified by:
getModifiers in interface JMember
Returns:
The modifiers for this JEnumConstant.

setArguments

public void setArguments(java.lang.String[] args)
Sets the arguments specified by this constant.

Parameters:
args - Initialization arguments for this constant.

getArguments

public java.lang.String[] 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

public void addMethod(JMethod jMethod)
Adds the given JMethod to this JEnumConstant.

Parameters:
jMethod - The JMethod to add.

addMethod

public void addMethod(JMethod jMethod,
                      boolean importReturnType)
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

public void addMethods(JMethod[] jMethods)
Adds the given array of JMethods to this JEnumConstant.

Parameters:
jMethods - The array of JMethod to add.

getMethods

public JMethod[] getMethods()
Returns an array of all the JMethods of this JEnumConstant.

Returns:
An array of all the JMethods of this JEnumConstant.

getMethodCount

public int getMethodCount()

getMethod

public JMethod getMethod(java.lang.String name,
                         int startIndex)
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

public JMethod getMethod(int index)
Returns the JMethod located at the specified index.

Parameters:
index - The index of the JMethod to return.
Returns:
The JMethod.

setName

public void setName(java.lang.String name)
Sets the name of this JEnumConstant.

Parameters:
name - The name of this JEnumConstant.

getName

public java.lang.String getName()
Returns the name of this JEnumConstant.

Specified by:
getName in interface JMember
Returns:
The name of this JEnumConstant.

setComment

public void setComment(JDocComment comment)
Sets the JavaDoc comment describing this JEnumConstant.

Parameters:
comment - The JavaDoc comment for this JEnumConstant.

setComment

public void setComment(java.lang.String comment)
Sets the JavaDoc comment describing this JEnumConstant.

Parameters:
comment - The JavaDoc comment for this JEnumConstant.

getComment

public JDocComment getComment()
Returns the JavaDoc comment describing this JEnumConstant.

Returns:
The JavaDoc comment describing this JEnumConstant, or null if none has been set.

print

public void print(JSourceWriter jsw)
prints this enum constant.

Parameters:
jsw - The JSourceWriter to print to. Must not be null.


Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com