|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.fullspan.propkeyconst.ConstantGenerator
Generates a Java source file with inner classes and constants (static final Strings) representing property keys.
| Field Summary | |
static java.lang.String |
INDENT
|
static java.lang.String |
USAGE
|
| Constructor Summary | |
ConstantGenerator(java.lang.String destDirPath,
java.lang.String packageName,
java.lang.String outerClassName,
RootClassDesc rootClassDesc)
Construct an instance of this class to generate a single .java file with all of the constants in the rootClassDesc. |
|
| Method Summary | |
protected void |
emit(java.lang.String text,
int level)
Break the text into lines, and emit each line separately, prefixed by the proper indentation. |
protected void |
emitConstants(ClassDesc classDesc)
|
protected void |
emitInnerClasses(ClassDesc classDesc)
|
protected void |
emitOuter()
|
void |
generate()
Generate the .java file with the directory, package name, and class name specified in this object's constructor. |
static java.lang.String |
getCommentBlock(ICommentHolder commentHolder)
If the commentHolder has a non-null comment, returns
a JavaDoc comment block with the commentHolder's comment text
embedded. |
static java.lang.String |
getIndent(int level)
|
static void |
main(java.lang.String[] args)
|
static java.lang.String |
merge(java.lang.String template,
java.util.Map paramMap)
Merges the parameters in the map into the template, using <% and %> as delimiters. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String USAGE
public static final java.lang.String INDENT
| Constructor Detail |
public ConstantGenerator(java.lang.String destDirPath,
java.lang.String packageName,
java.lang.String outerClassName,
RootClassDesc rootClassDesc)
rootClassDesc.
Note that the destDirPath and the packageName should be fully specified. They are not computed or checked against each other. For example, you would typically use values like this:
destDirPath - the filesystem path into which the generated
.java file will be placedpackageName - the package name that will be emitted with a
package statement at the top of the generated fileouterClassName - the class name for the generated filerootClassDesc - the root class descriptor, typically the caller
will get this from PropertyLoader.getRootClassDesc()| Method Detail |
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exceptionpublic static java.lang.String getIndent(int level)
INDENT
constant concatentated level number of times.public static java.lang.String getCommentBlock(ICommentHolder commentHolder)
commentHolder has a non-null comment, returns
a JavaDoc comment block with the commentHolder's comment text
embedded. Otherwise returns an empty string.
commentHolder -
public static java.lang.String merge(java.lang.String template,
java.util.Map paramMap)
Notice that the map drives the replacement, not the template. Neither of these are considered errors:
template - paramMap -
public void generate()
protected void emitOuter()
throws java.io.IOException
java.io.IOException
protected void emitConstants(ClassDesc classDesc)
throws java.io.IOException
java.io.IOException
protected void emitInnerClasses(ClassDesc classDesc)
throws java.io.IOException
java.io.IOException
protected void emit(java.lang.String text,
int level)
throws java.io.IOException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||