Methods Summary |
---|
public void | addClass(com.sun.jdo.spi.persistence.utility.generator.JavaClassWriter classWriter)Adds a class to this source file.
if (classWriter != null)
_classes.add(classWriter);
|
public void | addImport(java.lang.String importName, java.lang.String[] comments)Adds an import statement for this source file.
final FormattedWriter writerHelper = new FormattedWriter();
writerHelper.writeComments(comments);
if (importName != null && importName.length() > 0)
writerHelper.writeln("import " + importName + ';"); // NOI18N
_importStatements.add(writerHelper.toString());
|
protected static final java.util.ResourceBundle | getMessages() return _messages;
|
public void | save()Saves the file by writing out the source contents to whatever
file (or alternate representation) was specified (usually by the
constructor of the implementation class.
if (_file != null)
{
final File directory = _file.getParentFile();
final FileWriter fileWriter;
if (directory != null)
{
if (!directory.exists() && !directory.mkdirs())
{
throw new IOException(I18NHelper.getMessage(getMessages(),
"utility.unable_create_destination_directory", // NOI18N
directory.getPath()));
}
}
fileWriter = new FileWriter(_file);
try
{
fileWriter.write(toString());
}
finally
{
fileWriter.close();
}
}
|
public void | setPackage(java.lang.String packageName, java.lang.String[] comments)Sets the package for this file. Note that the package name format
must be package style (that is - it can contain . but not / or $).
final FormattedWriter writerHelper = new FormattedWriter();
writerHelper.writeComments(comments);
if (packageName != null && packageName.length() > 0)
{
writerHelper.writeln("package " + packageName + ';"); // NOI18N
writerHelper.writeln();
}
_packageBlock = writerHelper.toString();
|
public java.lang.String | toString()Returns a string representation of this object.
final FormattedWriter writerHelper = new FormattedWriter();
// package block
writerHelper.writeln();
if (_packageBlock != null)
writerHelper.write(_packageBlock);
writerHelper.writeList(_importStatements); // imports
writerHelper.writeList(_classes); // classes
return writerHelper.toString();
|