Public Member Functions | |
JInterface (String name) throws IllegalArgumentException | |
void | addField (JField jField) throws IllegalArgumentException |
void | addMember (JMember jMember) throws IllegalArgumentException |
void | addMethod (JMethodSignature jMethodSig) throws IllegalArgumentException |
JField | getField (String name) |
JField[] | getFields () |
JMethodSignature[] | getMethods () |
JMethodSignature | getMethod (String name, int startIndex) |
JMethodSignature | getMethod (int index) |
void | print (JSourceWriter jsw) |
void | print (JSourceWriter jsw, boolean classOnly) |
A representation of the Java Source code for a Java Interface. This is a useful utility when creating in memory source code. The code in this package was modelled after the Java Reflection API as much as possible to reduce the learning curve.
org.exolab.javasource.JInterface.JInterface | ( | String | name | ) | throws IllegalArgumentException |
Creates a new JInterface with the given name.
name | the name of the JInterface. |
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().
void org.exolab.javasource.JInterface.addField | ( | JField | jField | ) | throws IllegalArgumentException [virtual] |
Adds the given JField to this JStructure.
This method is implemented by subclasses and should only accept the proper fields for the subclass otherwise an IllegalArgumentException will be thrown. For example a JInterface will only accept static fields.
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.isArray(), org.exolab.javasource.JType.isPrimitive(), org.exolab.javasource.JModifiers.isPrivate(), and org.exolab.javasource.JNamedMap.put().
Referenced by org.exolab.javasource.JInterface.addMember().
void org.exolab.javasource.JInterface.addMember | ( | JMember | jMember | ) | throws IllegalArgumentException [virtual] |
Adds the given JMember to this JStructure.
This method is implemented by subclasses and should only accept the proper types for the subclass otherwise an IllegalArgumentException will be thrown.
jMember | the JMember to add to this JStructure. |
IllegalArgumentException | when the given JMember has the same name of an existing JField or JMethod respectively. |
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JInterface.addField().
void org.exolab.javasource.JInterface.addMethod | ( | JMethodSignature | jMethodSig | ) | throws IllegalArgumentException |
Adds the given JMethodSignature to this JClass
jMethodSig | the JMethodSignature to add. |
IllegalArgumentException | when the given JMethodSignature conflicts with an existing method signature. |
References org.exolab.javasource.JStructure.addImport(), org.exolab.javasource.JStructure.getAnnotations(), org.exolab.javasource.JType.getComponentType(), org.exolab.javasource.JMethodSignature.getModifiers(), org.exolab.javasource.JType.getName(), org.exolab.javasource.JMethodSignature.getName(), org.exolab.javasource.JType.isArray(), org.exolab.javasource.JType.isPrimitive(), and org.exolab.javasource.JModifiers.isProtected().
JField org.exolab.javasource.JInterface.getField | ( | String | name | ) | [virtual] |
Returns the field with the given name, or null if no field was found with the given name.
name | the name of the field to return. |
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JNamedMap.get().
JField [] org.exolab.javasource.JInterface.getFields | ( | ) | [virtual] |
Returns an array of all the JFields of this JStructure
Implements org.exolab.javasource.JStructure.
References org.exolab.javasource.JNamedMap.get(), and org.exolab.javasource.JNamedMap.size().
JMethodSignature org.exolab.javasource.JInterface.getMethod | ( | int | index | ) |
Returns the JMethodSignature at the given index.
index | the index of the JMethodSignature to return. |
JMethodSignature org.exolab.javasource.JInterface.getMethod | ( | String | name, | |
int | startIndex | |||
) |
Returns the JMethodSignature with the given name, and occuring at or after the given starting index.
name | the name of the JMethodSignature to return. | |
startIndex | the starting index to begin searching from. |
References org.exolab.javasource.JMethodSignature.getName().
JMethodSignature [] org.exolab.javasource.JInterface.getMethods | ( | ) |
Returns an array of all the JMethodSignatures of this JInterface.
void org.exolab.javasource.JInterface.print | ( | JSourceWriter | jsw, | |
boolean | classOnly | |||
) |
Prints the source code for this JInterface to the given JSourceWriter
jsw | the JSourceWriter to print to. [May not be null] |
References org.exolab.javasource.JSourceWriter.close(), org.exolab.javasource.JSourceWriter.flush(), org.exolab.javasource.JNamedMap.get(), org.exolab.javasource.JStructure.getAnnotatedElementHelper(), org.exolab.javasource.JField.getComment(), 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.JSourceWriter.indent(), org.exolab.javasource.JModifiers.isPrivate(), org.exolab.javasource.JModifiers.isPublic(), org.exolab.javasource.JMethodSignature.print(), org.exolab.javasource.JDocComment.print(), org.exolab.javasource.JStructure.printHeader(), org.exolab.javasource.JStructure.printImportDeclarations(), org.exolab.javasource.JStructure.printPackageDeclaration(), org.exolab.javasource.JNamedMap.size(), 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.JInterface.print | ( | JSourceWriter | jsw | ) | [virtual] |
Prints the source code for this JInterface 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.JCompUnit.printStructures().