Package eu.bandm.tools.annotations
Interface PreMessage
- All Known Implementing Classes:
SimpleMessage,SimpleMessage.Ping,SimplePreMessage
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 TypeMethodDescriptiondefault Stringformat()Returns the formatting of the template text and its arguments.Object[]getArgs()Returns the arguments.getText()Returns the template text.static PreMessagepreMessage(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
Returns the formatting of the template text and its arguments. Formatting is recursive: Any argument which is itself aPreMessageis formatted, and the result is used to replace a"%s"format specifier.- Returns:
- the formatted text.
- See Also:
-
preMessage
Factory method.- Parameters:
text- the template textargs- the arguments for formatting- Returns:
- a new instance
-