Classes | |
| class | JInnerClass |
Public Member Functions | |
| JClass (String name) throws IllegalArgumentException | |
| void | addConstructor (JConstructor constructor) throws IllegalArgumentException |
| void | addField (JField jField) throws IllegalArgumentException |
| void | addMember (JMember jMember) throws IllegalArgumentException |
| void | addMethod (JMethod jMethod) |
| void | addMethod (JMethod jMethod, boolean importReturnType) throws IllegalArgumentException |
| void | addMethods (JMethod[] jMethods) throws IllegalArgumentException |
| JConstructor | createConstructor () |
| JConstructor | createConstructor (JParameter[] params) |
| JClass | createInnerClass (String localname) |
| JConstructor | getConstructor (int index) |
| JConstructor[] | getConstructors () |
| JField | getField (String name) |
| JField[] | getFields () |
| JClass[] | getInnerClasses () |
| JMethod[] | getMethods () |
| JMethod | getMethod (String name, int startIndex) |
| JMethod | getMethod (int index) |
| JSourceCode | getStaticInitializationCode () |
| String | getSuperClass () |
| void | print (JSourceWriter jsw) |
| void | print (JSourceWriter jsw, boolean classOnly) |
| boolean | removeConstructor (JConstructor constructor) |
| boolean | removeMethod (JMethod method) |
| JField | removeField (String name) |
| boolean | removeField (JField jField) |
| boolean | removeInnerClass (JClass jClass) |
| void | setSuperClass (String superClass) |
Static Public Member Functions | |
| static void | main (String[] args) |
A representation of the Java Source code for a Java Class. This is a useful utility when creating in memory source code. This package was modelled after the Java Reflection API as much as possible to reduce the learning curve.
| org.exolab.javasource.JClass.JClass | ( | String | name | ) | throws IllegalArgumentException |
Creates a new JClass with the given name
| name | the name of the JClass to create |
| IllegalArgumentException | when the given name is not a valid Class name |
References org.exolab.javasource.JDocComment.appendComment(), org.exolab.javasource.JStructure.getJDocComment(), and org.exolab.javasource.JType.getLocalName().
Referenced by org.exolab.javasource.JClass.main().
| void org.exolab.javasource.JClass.addConstructor | ( | JConstructor | constructor | ) | throws IllegalArgumentException |
Adds the given Constructor to this classes list of constructors. The constructor must have been created with this JClass' createConstructor.
| IllegalArgumentException |
check signatures (add later)
References org.exolab.javasource.JStructure.addImport(), and org.exolab.javasource.JStructure.getAnnotations().
Referenced by org.exolab.javasource.JClass.createConstructor().
| void org.exolab.javasource.JClass.addField | ( | JField | jField | ) | throws IllegalArgumentException [virtual] |
Adds the given JField to this JClass
| jField,the | JField to add |
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JStructure.addImport(), org.exolab.javasource.JNamedMap.get(), org.exolab.javasource.JType.getComponentType(), org.exolab.javasource.JType.getName(), org.exolab.javasource.JType.isArray(), org.exolab.javasource.JType.isPrimitive(), and org.exolab.javasource.JNamedMap.put().
Referenced by org.exolab.javasource.JClass.addMember(), org.exolab.castor.builder.FieldInfo.createJavaField(), and org.exolab.javasource.JClass.main().
| void org.exolab.javasource.JClass.addMember | ( | JMember | jMember | ) | throws IllegalArgumentException [virtual] |
Adds the given JMember to this JClass
| jMember,the | JMember to add |
| IllegalArgumentException | when the given JMember has the same name of an existing JField or JMethod respectively, or if the JMember is of an unrecognized class. |
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JClass.addField(), org.exolab.javasource.JClass.addMethod(), and org.exolab.javasource.JMethod.getName().
Referenced by org.exolab.javasource.JClass.main().
| void org.exolab.javasource.JClass.addMethod | ( | JMethod | jMethod | ) |
Adds the given JMethod to this JClass
| jMethod,the | JMethod to add | |
| importReturnType | true if we add the importReturnType to the class import lists. It could be useful to set it to false when all types are fully qualified. |
| IllegalArgumentException | when the given JMethod has the same name of an existing JMethod. |
Referenced by org.exolab.javasource.JClass.addMember(), org.exolab.javasource.JClass.addMethods(), org.exolab.castor.builder.FieldInfo.createAccessMethods(), org.exolab.castor.builder.CollectionInfoJ2.createAccessMethods(), org.exolab.castor.builder.CollectionInfo.createAccessMethods(), org.exolab.castor.builder.SourceFactory.createEqualsMethod(), org.exolab.castor.builder.SourceFactory.createTestableMethods(), and org.exolab.javasource.JClass.main().
| void org.exolab.javasource.JClass.addMethod | ( | JMethod | jMethod, | |
| boolean | importReturnType | |||
| ) | throws IllegalArgumentException |
Adds the given JMethod to this JClass
| jMethod,the | JMethod to add | |
| importReturnType | true if we add the importReturnType to the class import lists. It could be useful to set it to false when all types are fully qualified. |
| IllegalArgumentException | when the given JMethod has the same name of an existing JMethod. |
References org.exolab.javasource.JStructure.addImport(), org.exolab.javasource.JStructure.getAnnotations(), org.exolab.javasource.JType.getComponentType(), org.exolab.javasource.JMethod.getModifiers(), org.exolab.javasource.JStructure.getModifiers(), org.exolab.javasource.JType.getName(), org.exolab.javasource.JMethod.getName(), org.exolab.javasource.JType.isArray(), org.exolab.javasource.JType.isPrimitive(), org.exolab.javasource.JModifiers.isPrivate(), and org.exolab.javasource.JModifiers.setAbstract().
| void org.exolab.javasource.JClass.addMethods | ( | JMethod[] | jMethods | ) | throws IllegalArgumentException |
Adds the given array of JMethods to this JClass
| jMethods,the | JMethod[] to add |
| IllegalArgumentException | when any of the given JMethods has the same name of an existing JMethod. |
References org.exolab.javasource.JClass.addMethod().
| JConstructor org.exolab.javasource.JClass.createConstructor | ( | JParameter[] | params | ) |
Creates a new JConstructor and adds it to this JClass.
References org.exolab.javasource.JClass.addConstructor(), and org.exolab.javasource.JConstructor.addParameter().
| JConstructor org.exolab.javasource.JClass.createConstructor | ( | ) |
Creates a new JConstructor and adds it to this JClass.
Referenced by org.exolab.javasource.JClass.main().
| JClass org.exolab.javasource.JClass.createInnerClass | ( | String | localname | ) |
Creates and returns an inner-class for this JClass
| localname | the name of the class (no package name) |
References org.exolab.javasource.JStructure.getPackageName().
Referenced by org.exolab.javasource.JClass.main().
| JConstructor org.exolab.javasource.JClass.getConstructor | ( | int | index | ) |
Returns the constructor at the specified index.
| index | the index of the constructor to return |
Referenced by org.exolab.castor.builder.DescriptorSourceFactory.createSource(), and org.exolab.castor.builder.SourceFactory.createSourceCode().
| JConstructor [] org.exolab.javasource.JClass.getConstructors | ( | ) |
Returns the an array of the JConstructors contained within this JClass
| JField org.exolab.javasource.JClass.getField | ( | String | name | ) | [virtual] |
Returns the member with the given name, or null if no member was found with the given name
| name | the name of the member to return |
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JNamedMap.get().
| JField [] org.exolab.javasource.JClass.getFields | ( | ) | [virtual] |
Returns an array of all the JFields of this JClass
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JNamedMap.get(), and org.exolab.javasource.JNamedMap.size().
Referenced by org.exolab.castor.builder.SourceFactory.createEqualsMethod(), and org.exolab.castor.builder.SourceFactory.createTestableMethods().
| JClass [] org.exolab.javasource.JClass.getInnerClasses | ( | ) |
| JMethod org.exolab.javasource.JClass.getMethod | ( | String | name, | |
| int | startIndex | |||
| ) |
Returns the first occurance of the method with the given name, starting from the specified index.
| name | the name of the method to look for | |
| startIndex | the starting index to begin the search |
References org.exolab.javasource.JMethod.getName().
Referenced by org.exolab.castor.builder.SourceFactory.createTestableMethods().
| JMethod org.exolab.javasource.JClass.getMethod | ( | int | index | ) |
| JMethod [] org.exolab.javasource.JClass.getMethods | ( | ) |
| JSourceCode org.exolab.javasource.JClass.getStaticInitializationCode | ( | ) |
Returns the JSourceCode for the static initializer of this JClass
Referenced by org.exolab.javasource.JClass.main().
| String org.exolab.javasource.JClass.getSuperClass | ( | ) |
Gets the super Class that this class extends
Referenced by org.exolab.castor.builder.SourceFactory.createEqualsMethod(), and org.exolab.castor.builder.SourceFactory.createSourceCode().
| static void org.exolab.javasource.JClass.main | ( | String[] | args | ) | [static] |
Test drive method...to be removed or commented out
References org.exolab.javasource.JSourceCode.add(), org.exolab.javasource.JClass.addField(), org.exolab.javasource.JStructure.addImport(), org.exolab.javasource.JClass.addMember(), org.exolab.javasource.JClass.addMethod(), org.exolab.javasource.JClass.createConstructor(), org.exolab.javasource.JClass.createInnerClass(), org.exolab.javasource.JField.getModifiers(), org.exolab.javasource.JConstructor.getSourceCode(), org.exolab.javasource.JClass.getStaticInitializationCode(), org.exolab.javasource.JClass.JClass(), org.exolab.javasource.JModifiers.makePrivate(), org.exolab.javasource.JClass.print(), org.exolab.javasource.JMethod.setSourceCode(), and org.exolab.javasource.JModifiers.setStatic().
| void org.exolab.javasource.JClass.print | ( | JSourceWriter | jsw, | |
| boolean | classOnly | |||
| ) |
Prints the source code for this JClass to the given JSourceWriter
| jsw | the JSourceWriter to print to. [May not be null] |
References org.exolab.javasource.JStructure.addImport(), org.exolab.javasource.JSourceWriter.flush(), org.exolab.javasource.JNamedMap.get(), org.exolab.javasource.JStructure.getAnnotatedElementHelper(), org.exolab.javasource.JField.getComment(), org.exolab.javasource.JStructure.getImports(), org.exolab.javasource.JField.getInitString(), org.exolab.javasource.JStructure.getInterfaceCount(), org.exolab.javasource.JStructure.getInterfaces(), org.exolab.javasource.JStructure.getJDocComment(), org.exolab.javasource.JType.getLocalName(), org.exolab.javasource.JField.getModifiers(), org.exolab.javasource.JStructure.getModifiers(), org.exolab.javasource.JField.getName(), org.exolab.javasource.JField.getType(), org.exolab.javasource.JStructure.hasImport(), org.exolab.javasource.JSourceWriter.indent(), org.exolab.javasource.JSourceCode.isEmpty(), org.exolab.javasource.JModifiers.isPrivate(), org.exolab.javasource.JModifiers.isPublic(), org.exolab.javasource.JClass.print(), org.exolab.javasource.JMethod.print(), org.exolab.javasource.JConstructor.print(), org.exolab.javasource.JDocComment.print(), org.exolab.javasource.JStructure.printHeader(), org.exolab.javasource.JStructure.printImportDeclarations(), org.exolab.javasource.JStructure.printPackageDeclaration(), org.exolab.javasource.JStructure.removeImport(), org.exolab.javasource.JNamedMap.size(), org.exolab.javasource.JSourceCode.toString(), org.exolab.javasource.JType.toString(), org.exolab.javasource.JModifiers.toString(), org.exolab.javasource.JSourceWriter.unindent(), org.exolab.javasource.JSourceWriter.write(), and org.exolab.javasource.JSourceWriter.writeln().
| void org.exolab.javasource.JClass.print | ( | JSourceWriter | jsw | ) | [virtual] |
Prints the source code for this JClass to the given JSourceWriter
| jsw | the JSourceWriter to print to. [May not be null] |
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JStructure.print().
Referenced by org.exolab.javasource.JClass.main(), org.exolab.javasource.JClass.print(), and org.exolab.javasource.JCompUnit.printStructures().
| boolean org.exolab.javasource.JClass.removeConstructor | ( | JConstructor | constructor | ) |
Removes the given constructor from this JClass
| constructor | the JConstructor to remove |
| JField org.exolab.javasource.JClass.removeField | ( | String | name | ) |
Removes the field with the given name from this JClass
| name | the name of the field to remove |
References org.exolab.javasource.JNamedMap.remove().
| boolean org.exolab.javasource.JClass.removeField | ( | JField | jField | ) |
Removes the given JField from this JClass
| jField,the | JField to remove |
References org.exolab.javasource.JNamedMap.get(), org.exolab.javasource.JField.getName(), and org.exolab.javasource.JNamedMap.remove().
| boolean org.exolab.javasource.JClass.removeInnerClass | ( | JClass | jClass | ) |
| boolean org.exolab.javasource.JClass.removeMethod | ( | JMethod | method | ) |
| void org.exolab.javasource.JClass.setSuperClass | ( | String | superClass | ) |
Sets the super Class that this class extends
| superClass | the super Class that this Class extends |
Referenced by org.exolab.castor.builder.SourceFactory.createSourceCode().
1.7.0