See: Description
| Class | Description |
|---|---|
| MessageMgr |
Manages Info, Warning and Error messages supporting
Message5WH, IsInfoSet, IsWarningSet, IsErrorSet, and DoesRender objects as well as arrays and collections of them. |
| MessageMgrBuilder |
Builds a
MessageMgr object with all settings. |
| MessageRenderer |
Renderer for a
Message5WH object. |
MessageRendererMessageRenderer.DEFAULT_STG_FN.
A default STGroup is also provided here MessageRenderer.DEFAULT_STG.
Any loaded STGroup will be validated against the required chunks. Those chunks define the expected methods and arguments the template must provide.
The chunks are defined in MessageRenderer.STG_CHUNKS as follows:
message5wh with arguments: reporter, type, who, when, where, what, why, howwhere with arguments: location, line, columntype argument, which can have the following values:
type.info - if the type is E_MessageType.INFOtype.warning - if the type is E_MessageType.WARNINGtype.error - if the type is E_MessageType.ERROR
Message5WH msg = new Message5WH_Builder()
.setWho("from " + this.getClass().getSimpleName())
.addWhat("showing a test message")
.setWhen(null)
.setWhere("the package API documentation", 0, 0)
.addWhy("as a demo")
.addHow("added to the package JavaDoc")
.setReporter("The Author")
.setType(EMessageType.INFO)
.build()
;
The following example loads a renderer using a defined template (in the src/test/resources of the package source) and uses that to render the message above:
Message5WH_Renderer ren = new Message5WH_Renderer("de/vandermeer/skb/base/message/5wh-example.stg");
String rendered = ren.render(msg);
System.out.println(rendered);
With this template the same message will render as:
showing a test message in the package API documentation created by from Test_Examples as a demo added to the package JavaDoc
This has been reported:
- by The Author
- as info
- at noon
Copyright © 2010–2017. All rights reserved.