public interface T
append
and include
calls are made. The buffer is cleared when
clear
and body
calls are made. Multiple buffers can be
managed at once on the stack using push_buffer
and pop_buffer
calls.Modifier and Type | Method and Description |
---|---|
default void |
append(Object o)
Append an object to the current buffer.
|
void |
append(String s)
Append a string to the current buffer.
|
String |
body()
Clear the current buffer and return the contents as a String.
|
void |
clear()
Clear the current buffer
|
void |
emit(String file)
Clear the current buffer and emit the contents to a file specified by
file . |
void |
include(String file,
Object... symbols)
Include an RSL template.
|
void |
pop_buffer()
Remove the current buffer and replace it with the next buffer on the
buffer stack.
|
void |
push_buffer()
Store the current buffer on the buffer stack and replace it with a new
buffer.
|
void |
set_output_directory(String dir)
Set the root directory for emitting files.
|
default String |
sub(String format,
Object o)
Perform a format substitution.
|
String |
sub(String format,
String s)
Perform a format substitution.
|
void append(String s)
s
- the string value to appenddefault void append(Object o)
toString
method before
being added to the buffer.o
- the object to appendString body()
void clear()
void emit(String file) throws XtumlException
file
.file
- the name of the output file relative to the configured output
directoryXtumlException
- if the file cannot be opened for writingset_output_directory(java.lang.String)
void include(String file, Object... symbols) throws XtumlException
symbols
.file
- the template file to include relative to the root template
directorysymbols
- the list of symbols to pass to the template. When invoked
from OAL, this list is composed by capturing all in-scope variables in
the context where it was invoked.XtumlException
- if an error occurs during template evaluationvoid pop_buffer()
void push_buffer()
void set_output_directory(String dir)
dir
- the root location for template outputString sub(String format, String s) throws XtumlException
u
(upper) - make all characters upper casec
(capitalize) - make the first character of each word capitalized and all
other characters of a word lowercasel
(lower) - make all characters lowercase_
(underscore) - change all whitespace characters to underscore charactersr
(remove) - remove all whitespaceo
(corba) - make the first word all lowercase, make the first character of
each following word capitalized and all other characters of the words
lowercase. Characters other than a-Z a-z 0-9 are ignoredt
(pass-through)format
parameter will be evaluated as a
format character sequentially left to right.format
- the string of format characters representing operations to
performs
- the string to formatXtumlException
- if an invalid format character is passeddefault String sub(String format, Object o) throws XtumlException
toString
method before being passed to
the sub
method.format
- the string of format characters representing operations to
performo
- the object to formatXtumlException
- if an invalid format character is passedCopyright © 2020. All rights reserved.