org.exolab.javasource
Class JInterface
public final class JInterface
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.
$Revision: 1.1.1.1 $ $Date: 2003/03/03 07:09:55 $
JInterface(String name) - Creates a new JInterface with the given name.
|
void | addField(JField jField) - Adds the given JField to this JStructure.
|
void | addMember(JMember jMember) - Adds the given JMember to this JStructure.
|
void | addMethod(JMethodSignature jMethodSig) - Adds the given JMethodSignature to this JClass
|
JField | getField(String name) - Returns the field with the given name, or null if no field
was found with the given name.
|
JField[] | getFields() - Returns an array of all the JFields of this JStructure
|
JMethodSignature | getMethod(String name, int startIndex) - Returns the JMethodSignature with the given name,
and occuring at or after the given starting index.
|
JMethodSignature | getMethod(int index) - Returns the JMethodSignature at the given index.
|
JMethodSignature[] | getMethods() - Returns an array of all the JMethodSignatures of this JInterface.
|
void | print(JSourceWriter jsw) - Prints the source code for this JInterface to the given JSourceWriter
|
void | print(JSourceWriter jsw, boolean classOnly) - Prints the source code for this JInterface to the given JSourceWriter
|
addField , addImport , addInterface , addInterface , addMember , getField , getFields , getFilename , getHeader , getImports , getInterfaceCount , getInterfaces , getJDocComment , getModifiers , getName , getPackageFromClassName , getPackageName , hasImport , isValidClassName , print , print , print , printHeader , printImportDeclarations , printPackageDeclaration , printlnWithPrefix , removeImport , setHeader , setPackageName |
JInterface
public JInterface(String name)
throws IllegalArgumentException
Creates a new JInterface with the given name.
name
- the name of the JInterface.
addField
public void addField(JField jField)
throws IllegalArgumentException
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.
- addField in interface JStructure
addMember
public void addMember(JMember jMember)
throws IllegalArgumentException
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.
- addMember in interface JStructure
jMember
- the JMember to add to this JStructure.
addMethod
public void addMethod(JMethodSignature jMethodSig)
throws IllegalArgumentException
Adds the given JMethodSignature to this JClass
jMethodSig
- the JMethodSignature to add.
getField
public JField getField(String name)
Returns the field with the given name, or null if no field
was found with the given name.
- getField in interface JStructure
name
- the name of the field to return.
- the field with the given name, or null if no field
was found with the given name.
getFields
public JField[] getFields()
Returns an array of all the JFields of this JStructure
- getFields in interface JStructure
- an array of all the JFields of this JStructure
getMethod
public JMethodSignature 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.
- the JMethodSignature, or null if not found.
getMethod
public JMethodSignature getMethod(int index)
Returns the JMethodSignature at the given index.
index
- the index of the JMethodSignature to return.
- the JMethodSignature at the given index.
getMethods
public JMethodSignature[] getMethods()
Returns an array of all the JMethodSignatures of this JInterface.
- an array of all the JMethodSignatures of this JInterface.
print
public void print(JSourceWriter jsw)
Prints the source code for this JInterface to the given JSourceWriter
- print in interface JStructure
jsw
- the JSourceWriter to print to. [May not be null]
print
public void 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]
Intalio Inc. (C) 1999-2003. All rights reserved http://www.intalio.com