|
SPT Core API | |||||||||
| 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 Map<String,String> |
fields
A Map of fields for the generated class. |
protected String |
name
The name of the class that is being generated. |
protected HashSet<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 String |
generateBeanMethods()
Generate the accessor and mutator methods for the JavaBean. |
protected String |
generateCloneMethod()
Generate the clone method for the JavaBean. |
protected String |
generateCompareToMethod()
Generate the compareTo method for the JavaBean. |
protected String |
generateEqualsMethod()
Generate the equals method for the JavaBean. |
protected String |
generateFields()
Generate the default fields for the class. |
protected String |
generateHashCodeMethod()
Generate the equals method for the JavaBean. |
protected 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 String name
protected Map<String,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 HashSet<String> primitives
HashSet containing the primitive types defined
for Java.
| Constructor Detail |
|---|
public CodeGenerator()
| Method Detail |
|---|
public abstract void generate()
throws Exception
Exception - If errors are encountered while generating
the source file.protected String generateFields()
protected String generateToStringMethod()
toString method for the JavaBean.
Generate an XML representation of the class and its fields.
toString method
implementation.protected String generateEqualsMethod()
equals method for the JavaBean.
equals method
implementation.protected String generateHashCodeMethod()
equals method for the JavaBean.
hashCode method
implementation.protected String generateCompareToMethod()
compareTo method for the JavaBean.
compareTo method
implementation.protected String generateCloneMethod()
clone method implementation.protected String generateBeanMethods()
fields.
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||