Purpose: Model a class for code generation purposes.
| Modifier and Type | Field and Description |
|---|---|
| protected Vector | |
| public static final int | |
| protected Vector | |
| protected Vector | |
| public static final int | |
| protected Vector | |
| protected Vector | |
| protected String | |
| protected String | |
| protected int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| private void | |
| public void | |
| public void | |
| public void | |
| private void | |
| private void | |
| public void | calculateImports()
Parses the class definition, pulls out fully qualified class names, adds imports for them, and un-fully qualifies the class names. |
| public boolean | |
| protected Vector | |
| protected Vector | |
| protected Vector | |
| protected Vector | |
| protected Vector | |
| public String | |
| public String | |
| public int | |
| public boolean | |
| protected void | |
| private void | |
| private void | |
| public void | |
| public void | setSuperClass(String superClass)
If the class to be generated is an interface, do not use this method. |
| public void | |
| protected void | |
| protected void | |
| public void | write(CodeGenerator generator)
Overrides org. |
| public void | writeBody(CodeGenerator generator)
Implements abstract org. |
| attributes | back to summary |
|---|---|
| protected Vector<AttributeDefinition> attributes | |
| CLASS_TYPE | back to summary |
|---|---|
| public static final int CLASS_TYPE | |
| imports | back to summary |
|---|---|
| protected Vector<String> imports | |
| innerClasses | back to summary |
|---|---|
| protected Vector<ClassDefinition> innerClasses | |
| INTERFACE_TYPE | back to summary |
|---|---|
| public static final int INTERFACE_TYPE | |
| interfaces | back to summary |
|---|---|
| protected Vector<String> interfaces | |
| methods | back to summary |
|---|---|
| protected Vector<MethodDefinition> methods | |
| packageName | back to summary |
|---|---|
| protected String packageName | |
| superClass | back to summary |
|---|---|
| protected String superClass | |
| type | back to summary |
|---|---|
| protected int type | |
| ClassDefinition | back to summary |
|---|---|
| public ClassDefinition() | |
| addAttribute | back to summary |
|---|---|
| public void addAttribute(AttributeDefinition attribute) | |
| addImport | back to summary |
|---|---|
| public void addImport(String importStatement) The importStatement should be of the form "{packageName}.{shortName or '*'}" | |
| addImports | back to summary |
|---|---|
| private void addImports(Map<String, Set<String>> typeNameMap) | |
| addInnerClass | back to summary |
|---|---|
| public void addInnerClass(ClassDefinition classDefinition) | |
| addInterface | back to summary |
|---|---|
| public void addInterface(String interfaceClassName) | |
| addMethod | back to summary |
|---|---|
| public void addMethod(MethodDefinition method) | |
| addTypeNamesToMap | back to summary |
|---|---|
| private void addTypeNamesToMap(HashMap<String, Set<String>> typeNameMap) | |
| adjustTypeNames | back to summary |
|---|---|
| private void adjustTypeNames(HashMap<String, Set<String>> typeNameMap) | |
| calculateImports | back to summary |
|---|---|
| public void calculateImports() Parses the class definition, pulls out fully qualified class names, adds imports for them, and un-fully qualifies the class names. - Assumes that no imports have been previously added. - Assumes that all types have been fully qualified to start. - Will not unqualify ambiguous classes (java.util.Date and java.sql.Date). - Will not add imports for java.lang.* - Will not add imports for classes in the same package. - Will not parse method bodies, but will unqualify types it finds. ?? - Should unqualification occur during writing? That way, reflective definitions could take advantage. | |
| containsMethod | back to summary |
|---|---|
| public boolean containsMethod(MethodDefinition method) | |
| getAttributes | back to summary |
|---|---|
| protected Vector | |
| getImports | back to summary |
|---|---|
| protected Vector | |
| getInnerClasses | back to summary |
|---|---|
| protected Vector | |
| getInterfaces | back to summary |
|---|---|
| protected Vector | |
| getMethods | back to summary |
|---|---|
| protected Vector | |
| getPackageName | back to summary |
|---|---|
| public String getPackageName() | |
| getSuperClass | back to summary |
|---|---|
| public String getSuperClass() | |
| getType | back to summary |
|---|---|
| public int getType() | |
| isInterface | back to summary |
|---|---|
| public boolean isInterface() | |
| replaceInterface | back to summary |
|---|---|
| protected void replaceInterface(String oldInterfaceName, String newInterfaceName) | |
| setImports | back to summary |
|---|---|
| private void setImports(Vector<String> imports) | |
| setMethods | back to summary |
|---|---|
| private void setMethods(Vector<MethodDefinition> methods) | |
| setPackageName | back to summary |
|---|---|
| public void setPackageName(String packageName) | |
| setSuperClass | back to summary |
|---|---|
| public void setSuperClass(String superClass) If the class to be generated is an interface, do not use this method. Instead, use addInterface(String) for each interface superclass. | |
| setType | back to summary |
|---|---|
| public void setType(int type) | |
| sortImports | back to summary |
|---|---|
| protected void sortImports() | |
| sortMethods | back to summary |
|---|---|
| protected void sortMethods() | |
| write | back to summary |
|---|---|
| public void write(CodeGenerator generator) Overrides org. Write the code out to the generator's stream.
| |
| writeBody | back to summary |
|---|---|
| public void writeBody(CodeGenerator generator) Implements abstract org. Write the code out to the generator's stream.
| |