org.exolab.javasource
Class JClass

java.lang.Object
  extended byorg.exolab.javasource.JType
      extended byorg.exolab.javasource.JStructure
          extended byorg.exolab.javasource.AbstractJClass
              extended byorg.exolab.javasource.JClass
All Implemented Interfaces:
JAnnotatedElement
Direct Known Subclasses:
DescriptorJClass, JInnerClass

public class JClass
extends AbstractJClass

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.

Version:
$Revision: 6669 $ $Date: 2005-05-08 12:32:06 -0600 (Sun, 08 May 2005) $
Author:
Keith Visco, Martin Skopp

Field Summary
 
Fields inherited from class org.exolab.javasource.JType
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT
 
Constructor Summary
JClass(java.lang.String name)
          Creates a new JClass with the given name.
 
Method Summary
 void addImport(java.lang.String className)
          Adds the given import to this JStructure. Note: You cannot import from the "default package," so imports with no package are ignored.
 void addMember(JMember jMember)
          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.
 JTypeName getSuperClass()
          Returns the super class that this class extends.
 java.lang.String getSuperClassQualifiedName()
          Returns the qualified name of the super class that this class extends.
 void print(JSourceWriter jsw, boolean classOnly)
          Prints the source code for this JClass to the given JSourceWriter.
 void setSuperClass(java.lang.String superClass)
          Sets the super Class that this class extends.
 
Methods inherited from class org.exolab.javasource.AbstractJClass
addConstructor, addField, addMethod, addMethod, addMethods, createConstructor, createConstructor, createInnerClass, getConstructor, getConstructors, getField, getFields, getInnerClasses, getMethod, getMethod, getMethods, getStaticInitializationCode, print, printClassHeaders, printConstructors, printInnerClasses, printMemberVariables, printMethods, printStaticInitializers, removeConstructor, removeField, removeField, removeInnerClass, removeMethod
 
Methods inherited from class org.exolab.javasource.JStructure
addAnnotation, addImport, addImport, addImportInternal, addInterface, getAnnotatedElementHelper, getAnnotation, getAnnotations, getFilename, getHeader, getImports, getInterfaceCount, getInterfaces, getJDocComment, getModifiers, getPackageName, hasAnnotations, hasImport, isAnnotationPresent, print, printHeader, printImportDeclarations, printPackageDeclaration, removeAnnotation, removeImport, setHeader, toString
 
Methods inherited from class org.exolab.javasource.JType
getLocalName, getName, isArray, isPrimitive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JClass

public JClass(java.lang.String name)
Creates a new JClass with the given name.

Parameters:
name - The name of the JClass to create.
Method Detail

addImport

public final void addImport(java.lang.String className)
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 class JStructure
Parameters:
className - Name of the class to import.

addMember

public final void addMember(JMember jMember)
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.

Specified by:
addMember in class JStructure
Parameters:
jMember - The JMember to add to this JStructure.

getSuperClass

public final JTypeName getSuperClass()
Returns the super class that this class extends.

Returns:
superClass The super class that this class extends.

getSuperClassQualifiedName

public final java.lang.String getSuperClassQualifiedName()
Returns the qualified name of the super class that this class extends.

Returns:
superClass The qualified name of the super class that this class extends.

setSuperClass

public final void setSuperClass(java.lang.String superClass)
Sets the super Class that this class extends.

Parameters:
superClass - The super Class that this Class extends.

print

public final void print(JSourceWriter jsw,
                        boolean classOnly)
Prints the source code for this JClass to the given JSourceWriter.

Specified by:
print in class AbstractJClass
Parameters:
classOnly - If true, the file header, package declaration, and imports are not printed.
jsw - The JSourceWriter to print to. Must not be null.


Intalio Inc. (C) 1999-2007. All rights reserved http://www.intalio.com