org.exolab.javasource

Class JEnumConstant

public final class JEnumConstant extends JAnnotatedElementHelper implements JMember

Describes the definition of a enum constant.

Author: Andrew Fawcett

Constructor Summary
JEnumConstant(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
voidaddMethod(JMethod jMethod)
Adds the given JMethod to this JEnumConstant.
voidaddMethod(JMethod jMethod, boolean importReturnType)
Adds the given JMethod to this JEnumConstant.
voidaddMethods(JMethod[] jMethods)
Adds the given array of JMethods to this JEnumConstant.
String[]getArguments()
Returns the arguments used by this constant.
JDocCommentgetComment()
Returns the JavaDoc comment describing this JEnumConstant.
JMethodgetMethod(String name, int startIndex)
Returns the first occurance of the method with the given name, starting from the specified index.
JMethodgetMethod(int index)
Returns the JMethod located at the specified index.
JMethod[]getMethods()
Returns an array of all the JMethods of this JEnumConstant.
JModifiersgetModifiers()
Returns the modifiers for this JEnumConstant.
StringgetName()
Returns the name of this JEnumConstant.
static voidmain(String[] args)
Test drive.
voidprint(JSourceWriter jsw)
prints this enum constant.
voidsetArguments(String[] args)
Sets the arguments specified by this constant.
voidsetComment(JDocComment comment)
Sets the JavaDoc comment describing this JEnumConstant.
voidsetComment(String comment)
Sets the JavaDoc comment describing this JEnumConstant.
voidsetName(String name)
Sets the name of this JEnumConstant.

Constructor Detail

JEnumConstant

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

Parameters: name name of the constant

JEnumConstant

public JEnumConstant(String name, 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

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

getArguments

public String[] getArguments()
Returns the arguments used by this constant.

Returns: the arguments used by this constant.

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.

getMethod

public JMethod getMethod(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.

getMethods

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

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

getModifiers

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

Returns: the modifiers for this JEnumConstant.

getName

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

Returns: the name of this JEnumConstant.

main

public static void main(String[] args)
Test drive.

Parameters: args command-line arguments

print

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

Parameters: jsw

setArguments

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

Parameters: args initialization arguments for this constant

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(String comment)
Sets the JavaDoc comment describing this JEnumConstant.

Parameters: comment the JavaDoc comment for this JEnumConstant

setName

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

Parameters: name the name of this JEnumConstant

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