org.apache.ws.jaxme.js
public class JavaSourceFactory extends Object implements JavaSourceResolver
Factory for generating JavaSource objects.
The factory properties:
are used for finely grained controlled over the generated source files. Methods are provided to access abstract descriptions of the files to be created:
Concrete files (source and otherwise) are created by calling the following construction methods:
Version: $Id: JavaSourceFactory.java 358952 2005-12-24 21:48:25Z jochen $
Method Summary | |
---|---|
JavaSource | getJavaSource(JavaQName pName) Returns the generated class with the given name or null, if no such class has been generated. |
Iterator | getJavaSources() Returns an iterator to the generated classes. |
File | getLocation(File pBaseDir, String pPackage) Returns a location the given package, relative to the given base directory. |
File | getLocation(File pBaseDir, JavaSource pJs) Returns a location for storing the JavaSource class, relative to the given base directory. |
File | getLocation(File pBaseDir, TextFile pTextFile) Returns a location for storing the TextFile, relative to the given base directory. |
Logger | getLogger() Returns the {@link Logger}. |
File | getPackageDirectory(File pBaseDir, String pPackageName) Given a package name and a base directory, returns the package directory. |
File | getSourceFile(File pBaseDir, JavaQName pQName) Given a fully qualified name, returns the name of the corresponding Java file. |
TextFile | getTextFile(String pPackageName, String pFileName) Returns the text file with the given name or null, if no such text file has been generated. |
Iterator | getTextFiles() Returns an iterator to the generated text files. |
boolean | isOverwriteForced() By default the JavaSourceFactory will only overwrite existing files, if they have different content. |
protected boolean | isSameFile(JavaSource pJs, File pFile) Verifies whether the given Java source and the contents of the given file are identical. |
protected boolean | isSameFile(String pContents, File pFile) Verifies whether the given string and the contents of the given file are identical. |
protected boolean | isSameFile(String pContents1, String pContents2) Verifies whether the given strings are identical. |
boolean | isSettingReadOnly() Returns whether the generated files are created in read-only mode. |
JavaSource | newJavaSource(JavaQName pName) Creates a new instance of JavaSource with the given name and default protection. |
JavaSource | newJavaSource(JavaQName pName, JavaSource.Protection pProtection) Creates a new instance of JavaSource with the given name and protection. |
JavaSource | newJavaSource(JavaQName pName, String pProtection) Creates a new instance of JavaSource with the given name and protection. |
TextFile | newTextFile(String pPackageName, String pFileName) Creates a new text file. |
void | setLogger(Logger pLogger) Sets the {@link Logger} to use. |
void | setOverwriteForced(boolean pOverwriteForced) By default the JavaSourceFactory will only overwrite existing files only, if they have different content. |
void | setSettingReadOnly(boolean pSettingReadOnly) Sets whether the generated files are created in read-only mode. |
void | write(File pBaseDir, JavaSource pJs) Writes the given JavaSource class to the file system, relative to the given base directory. |
void | write(File pBaseDir, TextFile pFile) Writes the given text file to the file system, relative to the given base directory. |
void | write(File pBaseDir) Writes all Source files to the FileSystem, relative to the
given base directory. |
void | write(File pJavaSourceDir, File pResourceDir) Writes all Source files to the file system, relative to the
respective base directory. |
protected void | writeFile(File pFile, JavaSource pJs) Actually creates a file with the given name. |
protected void | writeFile(File pFile, String pContents) Actually creates a file with the given name. |
Returns the generated class with the given name or null, if no such class has been generated.
Returns an iterator to the generated classes.
Returns a location the given package, relative to the given
base directory. For example, if you have the base
directory c:\temp
and the package
com.mycompany.demo
, this would yield
new File("c:\temp\com\mycompany\demo").
Parameters: pBaseDir The base directory or null for the current directory. pPackage The JavaSource being stored; null or the empty string for the root package
Returns: Directory related to the package; this may be null, if the base directory was null and the package was the root package
Returns a location for storing the JavaSource class, relative
to the given base directory. For example, if you have the base
directory c:\temp
and the class Sample
in package com.mycompany.demo
, this would yield
new File("c:\temp\com\mycompany\demo\Sample.java").
Parameters: pBaseDir The base directory or null for the current directory. pJs The JavaSource being stored.
Returns a location for storing the TextFile, relative
to the given base directory. For example, if you have the base
directory c:\temp
and the class Sample
in package com.mycompany.demo
, this would yield
new File("c:\temp\com\mycompany\demo\Sample.java").
Parameters: pBaseDir The base directory or null for the current directory. pTextFile The text file being created.
Returns the {@link Logger}.
Given a package name and a base directory, returns the package directory.
Parameters: pBaseDir The base directory, where to create sources; may be null (current directory).
Returns: Package directory; null is a valid value and indicates the current directory.
Given a fully qualified name, returns the name of the corresponding Java file.
Returns the text file with the given name or null, if no such text file has been generated.
Returns an iterator to the generated text files.
By default the JavaSourceFactory will only overwrite existing files, if they have different content. If the overwriteForced property is set to true, existing files will always be overwritten.
See Also: JavaSourceFactory
Verifies whether the given Java source and the contents of the given file are identical.
Verifies whether the given string and the contents of the given file are identical.
Verifies whether the given strings are identical.
Returns whether the generated files are created in read-only mode.
Creates a new instance of JavaSource with the given name and default protection.
Creates a new instance of JavaSource with the given name and protection.
Creates a new instance of JavaSource with the given
name and protection. Shortcut for
newJavaSource(pName, JavaSource.Protection.valueOf(pProtection))
.
Creates a new text file.
Sets the {@link Logger} to use.
By default the JavaSourceFactory will only overwrite existing files only, if they have different content. If the overwriteForced property is set to true, existing files will always be overwritten.
See Also: isOverwriteForced
Sets whether the generated files are created in read-only mode.
Writes the given JavaSource class to the file system, relative to the given base directory.
Parameters: pBaseDir The base directory or null for the current directory. pJs The JavaSource being stored.
See Also: write
Writes the given text file to the file system, relative to the given base directory.
Parameters: pBaseDir The base directory or null for the current directory. pFile The text file being stored.
See Also: write
Parameters: pBaseDir The base directory or null for the current directory.
Parameters: pJavaSourceDir The base directory for Java source files. pResourceDir The base directory for resource files.
Actually creates a file with the given name.
Actually creates a file with the given name.