public class ModelGenerator extends CodeGenerator
The following shows the invocation semantics for this class:
java -classpath <path to classes>:sptecho.jar:<path to Echo2_App.jar> \
com.sptci.echo2.ModelGenerator \
<fully qualified name of UI class>
Copyright 2006 Sans Pareil Technologies, Inc.
| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
imports
A
List of import statements for the generated class. |
protected Class |
source
The class for which the JavaBean is to be generated.
|
protected Map<String,Field> |
uiFields
|
fields, name, primitives| Constructor and Description |
|---|
ModelGenerator(String name)
Instantiates a new instance of
source from the specified
name. |
| Modifier and Type | Method and Description |
|---|---|
void |
generate()
Load the class specified, and generate a JavaBean representing its
UI components.
|
protected String |
generateBeanMethods()
Over-ridden to fire
PropertyChangeEvents for
mutator methods. |
protected String |
generateConstructors()
Generate the constructors for the JavaBean.
|
protected String |
generateDefaultConstructor()
Generate the default constructor for the JavaBean
|
protected String |
generateDesignatedConstructor()
Generate the designated constructor for the JavaBean
|
protected String |
generateFields()
Generate the fields for the JavaBean.
|
protected String |
generateMethods()
Generate the methods for the JavaBean.
|
protected String |
generatePropertyChangeFields()
Generate the fields necessary to support PropertyChangeListener
ability for the bean.
|
protected String |
generatePropertyChangeMethods()
Generate the methods to support property change events.
|
protected void |
generateSource()
Generate the source code for the JavaBean.
|
static void |
main(String[] args) |
protected void |
processComponent(Field field)
Generate a
Field for the JavaBean class that will be
generated from the specified Echo2 UI component |
generateCloneMethod, generateCompareToMethod, generateEqualsMethod, generateHashCodeMethod, generateToStringMethodprotected Class source
public ModelGenerator(String name) throws ClassNotFoundException
source from the specified
name. Initialises code geneartor containers.name - The fully qualified name of the class. Example:
com.sptci.demo.InputForm.ClassNotFoundException - If the class corresponding to the
name cannot be found in the classpath.public void generate()
throws Exception
generate in class CodeGeneratorException - If errors are encountered while writing to
the source file.processComponent(java.lang.reflect.Field),
generateSource()protected void processComponent(Field field)
Field for the JavaBean class that will be
generated from the specified Echo2 UI componentfield - The Field that represents the
Echo2 component.protected void generateSource()
throws IOException
IOException - If errors are encountered while writing the
generated source file.protected String generateFields()
generateFields in class CodeGeneratorgeneratePropertyChangeFields()protected String generatePropertyChangeFields()
protected String generateConstructors()
generateDefaultConstructor(),
generateDesignatedConstructor()protected String generateDefaultConstructor()
protected String generateDesignatedConstructor()
protected String generateMethods()
CodeGenerator.generateToStringMethod(),
CodeGenerator.generateEqualsMethod(),
CodeGenerator.generateHashCodeMethod(),
CodeGenerator.generateCompareToMethod(),
CodeGenerator.generateCloneMethod(),
generatePropertyChangeMethods(),
generateBeanMethods()protected String generatePropertyChangeMethods()
protected String generateBeanMethods()
PropertyChangeEvents for
mutator methods.generateBeanMethods in class CodeGeneratorCodeGenerator.fields.public static void main(String[] args)