|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.Writer
java.io.PrintWriter
au.gov.tas.dpiwe.mr.tool.ClosedSourceFileWriter
public class ClosedSourceFileWriter
ClosedSourceFileWriter takes a close source file, a set of global parameters, and a list of per key local parameters and produces a source file.
This class is used in the bean deployment process and for a number of other tools, and is a general approach to producing source files from templates.
| Field Summary | |
|---|---|
protected ListIterator |
abstractKeyParameterMapPairsIterator
An iterator over the per key local parameters |
protected ResourceBundle |
closeSource
The close source is a properties file decoded as a ResourceBundle. |
protected Object[] |
concreteKeyParameters
The set of global parameters. |
protected int |
indentLevel
The current indent level in the output source file. |
protected MutableBoolean |
inSlashStar
Indicates whether a slash-star comment is open. |
protected boolean |
statementIndentationOnThisBlock
Indicates whether this block is further indented because of an unclosed statement. |
| Fields inherited from class java.io.PrintWriter |
|---|
out |
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
ClosedSourceFileWriter(InputStream closeSourceStream,
Writer writer,
Object[] concreteKeyParameters,
List abstractKeyParameterMapPairs)
Construct a new closed source file writer. |
|
| Method Summary | |
|---|---|
protected void |
writeAbstractSequence(StringTokenizer sequence)
Writes the evaluation of an abstract key sequence. |
void |
writeClosedSourceFile()
Output the evaluation of the SourceFile abstract key to the output source file. |
protected void |
writeCompoundConcreteKey(String key)
Writes a compound concrete key, which is indicated in an abstract key with a key name followed by an asterisk. |
protected void |
writeCompoundConcreteKeyWithRepeatedKeys(String key)
Writes a compound concrete key with repeated keys, which is indicated in an abstract key with a key name enclosed in curly braces followed by an asterisk. |
protected void |
writeConcreteSequence(String line)
Writes the evaluation of a concrete key sequence. |
protected void |
writeKey(String key)
Writes the evaluation of a concrete or abstract key with the given name. |
protected void |
writeOptionalSection(StringTokenizer section,
String initialToken)
Writes a section bounded by box brackets either once, if there is an abstract key name matching that of the optional section in the abstract key parameter pairs, or not at all. |
protected void |
writeRepeatedSection(StringTokenizer section,
String initialToken)
Writes a section bounded by curly braces as many times as there are abstract key names matching those of the repeated section in the abstract key parameter pairs. |
protected void |
writeSelectionSection(StringTokenizer section,
String initialToken)
Writes a selected part of a section bounded by parentheses delimited by vertical bars based on the next abstract key name in the abstract key parameter pairs. |
| Methods inherited from class java.io.PrintWriter |
|---|
append, append, append, append, append, append, append, append, append, checkError, clearError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ResourceBundle closeSource
protected ListIterator abstractKeyParameterMapPairsIterator
protected Object[] concreteKeyParameters
protected int indentLevel
protected boolean statementIndentationOnThisBlock
protected MutableBoolean inSlashStar
| Constructor Detail |
|---|
public ClosedSourceFileWriter(InputStream closeSourceStream,
Writer writer,
Object[] concreteKeyParameters,
List abstractKeyParameterMapPairs)
throws IOException
closeSourceStream - the close source file stream.writer - the concrete source file writer.concreteKeyParameters - the set of global
parameters, which should be an array big enough to
accomodate local parameter indicies.abstractKeyParameterPairs - a list of
(<key-name>,
(<local-parameter-number>,
<value-or-collection>)) pairs.
entries for the global parameters per key.
IOException| Method Detail |
|---|
public void writeClosedSourceFile()
protected void writeKey(String key)
key - the key name.protected void writeAbstractSequence(StringTokenizer sequence)
sequence - the sequence of key names and
EBNF delimiters.
protected void writeRepeatedSection(StringTokenizer section,
String initialToken)
section - the section of a sequence to be
repeated.initialToken - the key name of the first item in
the section.
protected void writeOptionalSection(StringTokenizer section,
String initialToken)
section - the optional section of a sequence.initialToken - the key name of the first item in
the section.
protected void writeSelectionSection(StringTokenizer section,
String initialToken)
section - a selection section in a sequence.initialToken - the key name of the first item in
the section.protected void writeCompoundConcreteKey(String key)
Each concrete key expansion appears only once.
key - the key name (no trailing asterisk).protected void writeCompoundConcreteKeyWithRepeatedKeys(String key)
Each concrete key expansion whose referenced parameters are collection-valued in the current combination of local and global parameter value pairs may appear more than once or not at all depending on the number of entries in the collection. All other concrete key expansions appear just once.
key - the key name (no trailing asterisk,
not bounded by curly braces).protected void writeConcreteSequence(String line)
line - a source file line containing parameter
indicies in curly braces which will be expanded.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||