Interface T

  • All Known Implementing Classes:
    TImpl

    public interface T
    The T utility provides tools for working with RSL templates. The utility maintains a stack of String buffers. Each buffer accumulates content as 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.
    • Method Detail

      • append

        void append​(String s)
        Append a string to the current buffer.
        Parameters:
        s - the string value to append
      • append

        default void append​(Object o)
        Append an object to the current buffer. By default, the object gets converted to a String using the standard toString method before being added to the buffer.
        Parameters:
        o - the object to append
      • body

        String body()
        Clear the current buffer and return the contents as a String.
        Returns:
        the contents of the buffer
      • clear

        void clear()
        Clear the current buffer
      • include

        void include​(String file,
                     Object... symbols)
              throws XtumlException
        Include an RSL template. The in-scope variables in the location where invoked will be captured and passed as the list of symbols.
        Parameters:
        file - the template file to include relative to the root template directory
        symbols - 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.
        Throws:
        XtumlException - if an error occurs during template evaluation
      • pop_buffer

        void pop_buffer()
        Remove the current buffer and replace it with the next buffer on the buffer stack.
      • push_buffer

        void push_buffer()
        Store the current buffer on the buffer stack and replace it with a new buffer.
      • set_output_directory

        void set_output_directory​(String dir)
        Set the root directory for emitting files.
        Parameters:
        dir - the root location for template output
      • sub

        String sub​(String format,
                   String s)
            throws XtumlException
        Perform a format substitution. The following format characters are supported:
        • u (upper) - make all characters upper case
        • c (capitalize) - make the first character of each word capitalized and all other characters of a word lowercase
        • l (lower) - make all characters lowercase
        • _ (underscore) - change all whitespace characters to underscore characters
        • r (remove) - remove all whitespace
        • o (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 ignored
        • t (pass-through)
        Each character in the format parameter will be evaluated as a format character sequentially left to right.
        Parameters:
        format - the string of format characters representing operations to perform
        s - the string to format
        Returns:
        a formatted string
        Throws:
        XtumlException - if an invalid format character is passed
      • sub

        default String sub​(String format,
                           Object o)
                    throws XtumlException
        Perform a format substitution. By default, the object gets converted to a String using the standard toString method before being passed to the sub method.
        Parameters:
        format - the string of format characters representing operations to perform
        o - the object to format
        Returns:
        a formatted string
        Throws:
        XtumlException - if an invalid format character is passed