Interface PreMessage

All Known Implementing Classes:
SimpleMessage, SimpleMessage.Ping, SimplePreMessage

@CyclicDependency(reason="factory method") public interface PreMessage
Compositional fragment of a message.

Can be used as a negative result of a test, detail message of a exception, and diagnostic output. Consists of a template text and a list of arguments. The template text must serve as a format string for the arguments.

Since:
1.3
  • Method Summary

    Modifier and Type
    Method
    Description
    default String
    Returns the formatting of the template text and its arguments.
    Returns the arguments.
    Returns the template text.
    static PreMessage
    preMessage(String text, Object... args)
    Factory method.
  • Method Details

    • getArgs

      Object[] getArgs()
      Returns the arguments. Changing the array may or may not change this instance.
      Returns:
      the arguments.
    • getText

      String getText()
      Returns the template text.
      Returns:
      the template text.
    • format

      default String format()
      Returns the formatting of the template text and its arguments. Formatting is recursive: Any argument which is itself a PreMessage is formatted, and the result is used to replace a "%s" format specifier.
      Returns:
      the formatted text.
      See Also:
    • preMessage

      static PreMessage preMessage(String text, Object... args)
      Factory method.
      Parameters:
      text - the template text
      args - the arguments for formatting
      Returns:
      an new instace