Package org.exolab.javasource
Class JClass
java.lang.Object
org.exolab.javasource.JType
org.exolab.javasource.JStructure
org.exolab.javasource.AbstractJClass
org.exolab.javasource.JClass
- All Implemented Interfaces:
JAnnotatedElement
- Direct Known Subclasses:
DescriptorJClass
,JDODescriptorJClass
,JEnum
,JInnerClass
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: 8130 $ $Date: 2005-05-08 12:32:06 -0600 (Sun, 08 May 2005) $
- Author:
- Keith Visco, Martin Skopp
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Adds the given import to this JStructure.void
Adds the given JMember to this JStructure.void
changeLocalName
(String localName) Changes the local name of this class type.final JTypeName
Returns the super class that this class extends.final String
Returns the qualified name of the super class that this class extends.void
print
(JSourceWriter jsw, boolean classOnly) Deprecated.Please use the Velocity-template based approach instead.final void
setSuperClass
(String superClass) Sets the super Class that this class extends.Methods inherited from class org.exolab.javasource.AbstractJClass
addConstant, addConstructor, addField, addMethod, addMethod, addMethods, addSourceCode, createConstructor, createConstructor, createInnerClass, getConstant, getConstantCount, getConstants, getConstructor, getConstructors, getContructorsCount, getField, getFieldCount, getFields, getInnerClassCount, getInnerClasses, getMethod, getMethod, getMethodCount, getMethods, getSourceCodeEntries, getSourceCodeEntryCount, getStaticInitializationCode, print, printClassHeaders, printConstantDefinitions, printConstructors, printInnerClasses, printMemberVariables, printMethods, printSourceCodeFragments, printStaticInitializers, removeConstant, removeConstant, removeConstructor, removeField, removeField, removeInnerClass, removeMethod
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
-
JClass
Creates a new JClass with the given name.- Parameters:
name
- The name of the JClass to create.
-
-
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 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 classJStructure
- Parameters:
jMember
- The JMember to add to this JStructure.
-
getSuperClass
Returns the super class that this class extends.- Returns:
- superClass The super class that this class extends.
-
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
Sets the super Class that this class extends.- Parameters:
superClass
- The super Class that this Class extends.
-
print
Deprecated.Please use the Velocity-template based approach instead.Prints the source code for this JClass to the given JSourceWriter.- Specified by:
print
in classAbstractJClass
- Parameters:
jsw
- The JSourceWriter to print to. Must not be null.classOnly
- If true, the file header, package declaration, and imports are not printed.- See Also:
-
changeLocalName
Changes the local name of this class type.- Parameters:
localName
- The new local name to be used.
-