public class MessageMgr extends Object implements HasToStringStyle
Message5WH, IsInfoSet, IsWarningSet, IsErrorSet, and DoesRender objects as well as arrays and collections of them.| Modifier and Type | Field and Description |
|---|---|
protected Object |
appID
The identifier (or name) of the application using the message manager.
|
protected boolean |
doCollectMessages
Flag to define the behavior for message collection.
|
protected STGroup |
max100stg
STGroup for max100 messages.
|
protected Map<E_MessageType,MessageTypeHandler> |
messageHandlers
Maps of message handlers for message types.
|
protected LinkedHashMap<String,E_MessageType> |
messages
Map of collected messages (errors, warnings, information) as rendered strings.
|
protected MessageRenderer |
renderer
Message renderer.
|
| Modifier and Type | Method and Description |
|---|---|
MessageMgr |
clear()
Resets the collected messages and all counters.
|
static Message5WH |
createErrorMessage(String what,
Object... obj)
Creates a new error message.
|
static Message5WH |
createInfoMessage(String what,
Object... obj)
Creates a new information message.
|
static Message5WH |
createWarningMessage(String what,
Object... obj)
Creates a new warning message.
|
Collection<String> |
getMessageCollection()
Returns the collected messages.
|
int |
getMessageCount(E_MessageType type)
Returns the current count for the given message type since its last initialization or reset.
|
Map<String,E_MessageType> |
getMessageMap()
Returns the collected messages.
|
boolean |
hasErrors()
Returns true if the manager has errors reported, false otherwise
|
boolean |
hasInfos()
Returns true if the manager has infos reported, false otherwise
|
boolean |
hasWarnings()
Returns true if the manager has warnings reported, false otherwise
|
boolean |
isEnabledFor(E_MessageType type)
Returns is the report level is enabled or not.
|
static Map<String,Set<String>> |
loadChunks()
Returns a map set with all expected template names and their expected arguments.
|
protected boolean |
report(IsMessageSet messageSet)
Reports a message.
|
protected boolean |
report(Message5WH message)
Reports a message.
|
boolean |
report(Object obj)
Reports a message.
|
protected boolean |
reportKnownClasses(Object message)
Reports a message trying all known classes (message formats).
|
MessageMgr |
setRenderer(MessageRenderer renderer)
Sets an renderer for the object, which then will be used to render all messages.
|
String |
toString() |
protected final LinkedHashMap<String,E_MessageType> messages
protected final Map<E_MessageType,MessageTypeHandler> messageHandlers
protected final boolean doCollectMessages
protected MessageRenderer renderer
protected final STGroup max100stg
protected final Object appID
public static final Map<String,Set<String>> loadChunks()
public static Message5WH createInfoMessage(String what, Object... obj)
what - the what part of the message (what has happened)obj - objects to add to the messagepublic static Message5WH createWarningMessage(String what, Object... obj)
what - the what part of the message (what has happened)obj - objects to add to the messagepublic static Message5WH createErrorMessage(String what, Object... obj)
what - the what part of the message (what has happened)obj - objects to add to the messagepublic MessageMgr setRenderer(MessageRenderer renderer)
renderer - new rendererpublic Collection<String> getMessageCollection()
public Map<String,E_MessageType> getMessageMap()
public boolean hasErrors()
public boolean hasWarnings()
public boolean hasInfos()
public int getMessageCount(E_MessageType type)
type - message type to report count forpublic boolean isEnabledFor(E_MessageType type)
type - message type to checkprotected boolean report(Message5WH message)
message - to be reportedprotected boolean report(IsMessageSet messageSet)
messageSet - message to be reportedprotected boolean reportKnownClasses(Object message)
message - message to be reportedpublic boolean report(Object obj)
Message5WH, IsMessageSet, HasErrorSet, HasWarningSet, and HasInfoSet.
It also does process iterators, iterables, and arrays of any type to process the message formats mentioned above.
All objects not understood will be silently ignored.obj - message object or object containing messages for reportingpublic MessageMgr clear()
Copyright © 2010–2017. All rights reserved.