Package org.exolab.javasource
Class JInterface
java.lang.Object
org.exolab.javasource.JType
org.exolab.javasource.JStructure
org.exolab.javasource.JInterface
- All Implemented Interfaces:
JAnnotatedElement
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 modeled after the Java Reflection API as much as possible to reduce the
learning curve.
- Version:
- $Revision: 8329 $ $Date: 2005-02-26 17:30:28 -0700 (Sat, 26 Feb 2005) $
- Author:
- Martin Skopp, Keith Visco
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the given JField to this Jinterface.void
Adds the given import to this JStructure.void
Adds the given JMember to this Jinterface.void
addMethod
(JMethodSignature jMethodSig) Adds the given JMethodSignature to this Jinterface.Returns the field with the given name, or null if no field was found with the given name.JField[]
Returns an array of all the JFields of this Jinterface.getMethod
(int index) Returns the JMethodSignature at the given index.Returns the JMethodSignature with the given name and occuring at or after the given starting index.Returns an array of all the JMethodSignatures of this JInterface.void
print
(JSourceWriter jsw) Deprecated.Please use the Velocity-template based approach instead.void
print
(JSourceWriter jsw, boolean classOnly) Deprecated.Please use the Velocity-template based approach instead.Methods inherited from class org.exolab.javasource.JStructure
addAnnotation, addImport, addImport, addImportInternal, addInterface, getAnnotatedElementHelper, getAnnotation, getAnnotations, getFilename, getHeader, getImportCount, getImports, getInterfaceCount, getInterfaces, getJDocComment, getModifiers, getPackageName, hasAnnotations, hasImport, isAnnotationPresent, print, printHeader, printImportDeclarations, printPackageDeclaration, removeAnnotation, removeImport, removeInterface, setHeader, toString
Methods inherited from class org.exolab.javasource.JType
getLocalName, getName, isArray, isPrimitive, setName
-
Constructor Details
-
JInterface
Creates a new JInterface with the given name.- Parameters:
name
- The name of the JInterface.
-
-
Method Details
-
addImport
Adds the given import to this JStructure. Note: You cannot import from the "default package," so imports with no package are ignored.- Specified by:
addImport
in classJStructure
- Parameters:
className
- Name of the class to import.
-
addMember
Adds the given JMember to this Jinterface.This method is implemented by subclasses and should only accept the proper types for the subclass otherwise an IllegalArgumentException will be thrown.
- Specified by:
addMember
in classJStructure
- Parameters:
jMember
- The JMember to add to this JStructure.
-
getFields
Returns an array of all the JFields of this Jinterface.- Specified by:
getFields
in classJStructure
- Returns:
- An array of all the JFields of this Jinterface.
-
getField
Returns the field with the given name, or null if no field was found with the given name.- Specified by:
getField
in classJStructure
- Parameters:
name
- The name of the field to return.- Returns:
- The field with the given name, or null if no field was found with the given name.
-
addField
Adds the given JField to this Jinterface.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.
- Specified by:
addField
in classJStructure
- Parameters:
jField
- The JField to add.
-
getMethods
Returns an array of all the JMethodSignatures of this JInterface.- Returns:
- An array of all the JMethodSignatures of this JInterface.
-
getMethod
Returns the JMethodSignature with the given name and occuring at or after the given starting index.- Parameters:
name
- The name of the JMethodSignature to return.startIndex
- The starting index to begin searching from.- Returns:
- The JMethodSignature, or null if not found.
-
getMethod
Returns the JMethodSignature at the given index.- Parameters:
index
- The index of the JMethodSignature to return.- Returns:
- The JMethodSignature at the given index.
-
addMethod
Adds the given JMethodSignature to this Jinterface.- Parameters:
jMethodSig
- The JMethodSignature to add.
-
print
Deprecated.Please use the Velocity-template based approach instead.Prints the source code for this JStructure to the given JSourceWriter.- Specified by:
print
in classJStructure
- Parameters:
jsw
- The JSourceWriter to print to.- See Also:
-
print
Deprecated.Please use the Velocity-template based approach instead.Prints the source code for this JInterface to the given JSourceWriter.- Parameters:
jsw
- The JSourceWriter to print to. Must not be null.classOnly
- If true, generates the class body without the class header, package declaration, or imports.- See Also:
-