ca.quine.jcommons.sourcegen
Class ClassSource

java.lang.Object
  |
  +--ca.quine.jcommons.sourcegen.ClassSource

public class ClassSource
extends Object


Constructor Summary
ClassSource(boolean isPublic, String name)
          Constructs a new ClassSource object (which represents a class).
 
Method Summary
 void addField(FieldSource field)
           
 void addMethod(MethodSource method)
           
 void addProperty(String type, String name)
          Create a new private field of type type with name name and create and accessor and mutator method for it.
 CommentSource getComment()
           
 Iterator getFieldIterator()
          Returns an Iterator of FieldSource objects.
 int getModifiers()
          See the public static finals on Modifier.
 String getName()
           
 String getSuperClass()
           
 boolean isPublic()
          Returns true if and only if this class represents the public class in a Java source file.
 void output(FormattingRules rules, StringBuffer buffer)
          Formats and outputs this class (with the given FormattingRules) into the given StringBuffer.
 void setComment(JavaDocCommentSource commentSource)
           
 void setImplements(ArrayList interfaces)
          Sets the given ArrayList of String objects as the interfaces that this class implements.
 void setImplements(String interfaceName)
          Sets the given interface as the only one this class implements.
 void setModifiers(int modifiers)
          See the public static finals on Modifier.
 void setSuperClass(String superClass)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassSource

public ClassSource(boolean isPublic,
                   String name)
Constructs a new ClassSource object (which represents a class).

Parameters:
isPublic - Pass "true" if this class is the public class in a source file, false otherwise.
Method Detail

setModifiers

public void setModifiers(int modifiers)
See the public static finals on Modifier.

Parameters:
modifiers -

getModifiers

public int getModifiers()
See the public static finals on Modifier.


addField

public void addField(FieldSource field)

addMethod

public void addMethod(MethodSource method)

addProperty

public void addProperty(String type,
                        String name)
Create a new private field of type type with name name and create and accessor and mutator method for it.

Parameters:
type -
name -

setImplements

public void setImplements(String interfaceName)
Sets the given interface as the only one this class implements. If other interfaces were already provided, they are first cleared.

Parameters:
interfaceName -

setImplements

public void setImplements(ArrayList interfaces)
Sets the given ArrayList of String objects as the interfaces that this class implements.

Parameters:
interfaces -

output

public void output(FormattingRules rules,
                   StringBuffer buffer)
Formats and outputs this class (with the given FormattingRules) into the given StringBuffer.

Parameters:
rules -
buffer -

isPublic

public boolean isPublic()
Returns true if and only if this class represents the public class in a Java source file.

Returns:
true if this class represents the public class in a Java source file, false otherwise

getFieldIterator

public Iterator getFieldIterator()
Returns an Iterator of FieldSource objects.

Returns:
an Iterator of FieldSource objects

getName

public String getName()

getSuperClass

public String getSuperClass()

setSuperClass

public void setSuperClass(String superClass)

setComment

public void setComment(JavaDocCommentSource commentSource)

getComment

public CommentSource getComment()