|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.CodeGenerator
public abstract class CodeGenerator
An abstract code generator. Generates the code for common methods that are implemented in source code.
Copyright 2006 Sans Pareil Technologies, Inc.
| Field Summary | |
|---|---|
protected java.util.Map<java.lang.String,java.lang.String> |
fields
A Map of fields for the generated class. |
protected java.lang.String |
name
The name of the class that is being generated. |
protected java.util.HashSet<java.lang.String> |
primitives
A HashSet containing the primitive types defined
for Java. |
| Constructor Summary | |
|---|---|
CodeGenerator()
Default constructor. |
|
| Method Summary | |
|---|---|
abstract void |
generate()
The abstract method that will generate the full source code. |
protected java.lang.String |
generateBeanMethods()
Generate the accessor and mutator methods for the JavaBean. |
protected java.lang.String |
generateCloneMethod()
Generate the clone method for the JavaBean. |
protected java.lang.String |
generateCompareToMethod()
Generate the compareTo method for the JavaBean. |
protected java.lang.String |
generateEqualsMethod()
Generate the equals method for the JavaBean. |
protected java.lang.String |
generateFields()
Generate the default fields for the class. |
protected java.lang.String |
generateHashCodeMethod()
Generate the equals method for the JavaBean. |
protected java.lang.String |
generateToStringMethod()
Generate the toString method for the JavaBean. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String name
protected java.util.Map<java.lang.String,java.lang.String> fields
Map of fields for the generated class.
The name of the field is stored as the key and the
type of the field as the value.
protected java.util.HashSet<java.lang.String> primitives
HashSet containing the primitive types defined
for Java.
| Constructor Detail |
|---|
public CodeGenerator()
| Method Detail |
|---|
public abstract void generate()
throws java.lang.Exception
java.lang.Exception - If errors are encountered while generating
the source file.protected java.lang.String generateFields()
protected java.lang.String generateToStringMethod()
toString method for the JavaBean.
Generate an XML representation of the class and its fields.
toString method
implementation.protected java.lang.String generateEqualsMethod()
equals method for the JavaBean.
equals method
implementation.protected java.lang.String generateHashCodeMethod()
equals method for the JavaBean.
hashCode method
implementation.protected java.lang.String generateCompareToMethod()
compareTo method for the JavaBean.
compareTo method
implementation.protected java.lang.String generateCloneMethod()
clone method implementation.protected java.lang.String generateBeanMethods()
fields.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||