|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.iscreen.ognl.OgnlMessage
public class OgnlMessage
An OGNL message wraps a "template" that is a String of characters. This template may contain "OGNL tags" that look like this: ${some ognl}. When a ${} is found within the template, it's removed, and the contents are considered an OGNL expression, which is evaluated based upon an OGNL root (either set separately or passed in when generating the message).
Field Summary | |
---|---|
protected java.util.Map |
extraMessages
|
protected java.lang.Object |
root
|
protected int |
severityLevel
|
protected java.lang.String |
template
|
Constructor Summary | |
---|---|
protected |
OgnlMessage()
For sub-classes to over-ride how this works. |
|
OgnlMessage(java.lang.String theTemplate,
int severity)
Constructor taking the template of this message. |
Method Summary | |
---|---|
void |
addMessage(java.lang.String name,
OgnlMessage extraMessage)
Adds an additional message. |
static java.lang.String |
constructMessage(java.lang.String theTemplate,
java.lang.Object ognlRoot)
Searches through the template and replaces all ${} with the evaluation of their OGNL expressions. |
java.util.Map |
getExtraMessages()
Retrieves additional messages that are associated with the failure. |
java.lang.String |
getMessage()
Generates a message based upon the template of this message and the OGNL root passed in to the setOgnlRoot() method. |
java.lang.String |
getMessage(java.lang.Object ognlRoot,
java.util.Locale locale)
Generates a message based upon the template of this message and the OGNL root passed in. |
java.lang.Object |
getOgnlRoot()
Returns the OGNL root previously set using the setOgnlRoot() method. |
int |
getSeverity()
Retrieves the failure's severity level. |
java.lang.String |
getTemplate(java.util.Locale locale)
Returns the template previously set during construction. |
void |
setOgnlRoot(java.lang.Object ognlRoot)
Sets the OGNL root to be used when getMessage() is called. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String template
protected java.lang.Object root
protected int severityLevel
protected java.util.Map extraMessages
Constructor Detail |
---|
public OgnlMessage(java.lang.String theTemplate, int severity)
theTemplate
- The template (which may or may not contain OGNL tags)protected OgnlMessage()
Method Detail |
---|
public java.util.Map getExtraMessages()
FailureMessage
getExtraMessages
in interface FailureMessage
public void addMessage(java.lang.String name, OgnlMessage extraMessage)
name
- The name of the message.extraMessage
- The extra message.public void setOgnlRoot(java.lang.Object ognlRoot)
ognlRoot
- The OGNL root object.public java.lang.String getMessage()
public java.lang.String getMessage(java.lang.Object ognlRoot, java.util.Locale locale)
getMessage
in interface FailureMessage
ognlRoot
- The OGNL root to use for generating the message.locale
- The locale use for localizing the message.
public int getSeverity()
FailureMessage
getSeverity
in interface FailureMessage
public java.lang.Object getOgnlRoot()
public java.lang.String getTemplate(java.util.Locale locale)
locale
- The locale to use.
public static java.lang.String constructMessage(java.lang.String theTemplate, java.lang.Object ognlRoot)
theTemplate
- The template to use.ognlRoot
- The OGNL root.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |