org.exolab.javasource
public final class JCompUnit extends Object
Version: $Revision: 6324 $ $Date: 2005-03-05 06:42:06 -0700 (Sat, 05 Mar 2005) $
Constructor Summary | |
---|---|
JCompUnit(String packageName, String fileName)
Creates a new JCompUnit.
| |
JCompUnit(JClass jClass)
Creates a new JCompUnit with the given JClass (which must have been
created with either a full class name or package/local name) as the
public class. | |
JCompUnit(JInterface jInterface)
Creates a new JCompUnit with the given JInterface as public interface.
|
Method Summary | |
---|---|
void | addClass(JClass jClass)
Adds a JClass to be printed in this file.
|
void | addInterface(JInterface jInterface)
Adds a JInterface to be printed in this file.
|
void | addStructure(JStructure jStructure)
Adds the given JStructure (either a JInterface or a JClass) to this
JCompUnit.
|
String | getFilename(String destDir) |
SortedSet | getImports()
Returns a array of String containing all imported classes/packages, also
imports within the same package of this object.
|
protected static String | getPackageFromClassName(String className)
Returns the package name of the provided class name. |
String | getPackageName()
Returns the name of the package that this JCompUnit is a member of.
|
void | print()
Prints the source code for this JClass in the current directory with the
default line seperator of the the runtime platform.
|
void | print(String destDir)
Prints the source code for this JClass with the default line seperator of
the the runtime platform.
|
void | print(String destDir, String lineSeparator)
Prints the source code for this JCompUnit using the provided root
directory and line separator.
|
void | print(JSourceWriter jsw)
Prints the source code for this JClass to the provided JSourceWriter.
|
void | printStructures(JSourceWriter jsw, boolean printPublic)
Print the source code for the contained JClass objects.
|
void | setHeader(JComment comment)
Sets the header comment for this JCompUnit.
|
Parameters: packageName the name of the package for this JCompUnit. If packageName is null or empty, no 'package' line will be generated. fileName the name of the file to which this JCompUnit will be written
Parameters: jClass the public class for this JCompUnit
Parameters: jInterface the public interface for this JCompUnit.
Parameters: jClass the JClass to be printed in this file
Parameters: jInterface the JInterface to be printed in this file
Parameters: jStructure the JStructure to add
Parameters: destDir the destination directory. This may be null.
Returns: the name of the file that this JCompUnit would be printed to
Returns: a array of String containing all import classes/packages, also imports within the same package of this object
Parameters: className name from which to extract the package
Returns: the package name of the provided class name.
Returns: the name of the package that this JCompUnit is a member of, or null if there is no current package name defined
See Also: JCompUnit
Parameters: destDir the destination directory to use as the root directory for source generation
See Also: JCompUnit
Parameters: destDir the destination directory to use as the root directory for source generation lineSeparator the line separator to use at the end of each line. If null, then the default line separator for the runtime platform will be used.
Parameters: jsw the JSourceWriter to print to
Parameters: jsw the JSourceWriter to print to. printPublic if true, print only public classes; if false, print only non-public classes.
Parameters: comment the comment to display at the top of the source file when printed