public abstract class CodeGenerator extends Object
Copyright 2006 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
CodeGenerator()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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. |
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.public CodeGenerator()
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.