| java.lang.Object org.iscreen.ognl.OgnlMessage
All known Subclasses: org.iscreen.ognl.OgnlResourceMessage,
OgnlMessage | public class OgnlMessage implements FailureMessage(Code) | | 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).
author: Shellman, Dan |
Constructor Summary | |
public | OgnlMessage(String theTemplate) Constructor taking the template of this message. | protected | OgnlMessage() For sub-classes to over-ride how this works. |
Method Summary | |
protected String | constructMessage(String theTemplate, Object ognlRoot) Searches through the template and replaces all ${} with the evaluation
of their OGNL expressions.
Parameters: theTemplate - The template to use. Parameters: ognlRoot - The OGNL root. | public String | getMessage() Generates a message based upon the template of this message and the
OGNL root passed in to the setOgnlRoot() method. | public String | getMessage(Object ognlRoot, Locale locale) Generates a message based upon the template of this message and the
OGNL root passed in. | public Object | getOgnlRoot() Returns the OGNL root previously set using the setOgnlRoot() method. | public String | getTemplate(Locale locale) Returns the template previously set during construction.
Parameters: locale - The locale to use. | public void | setOgnlRoot(Object ognlRoot) Sets the OGNL root to be used when getMessage() is called. |
OgnlMessage | public OgnlMessage(String theTemplate)(Code) | | Constructor taking the template of this message. The template should
never be null.
Parameters: theTemplate - The template (which may or may not contain OGNL tags) |
OgnlMessage | protected OgnlMessage()(Code) | | For sub-classes to over-ride how this works.
|
constructMessage | protected String constructMessage(String theTemplate, Object ognlRoot)(Code) | | Searches through the template and replaces all ${} with the evaluation
of their OGNL expressions.
Parameters: theTemplate - The template to use. Parameters: ognlRoot - The OGNL root. Returns the constructed String. |
getMessage | public String getMessage()(Code) | | Generates a message based upon the template of this message and the
OGNL root passed in to the setOgnlRoot() method. If the OGNL root object
is null, then this method will return the template unchanged.
Returns the message, which is constructed based upon the OGNLroot and the template. |
getMessage | public String getMessage(Object ognlRoot, Locale locale)(Code) | | Generates a message based upon the template of this message and the
OGNL root passed in. If the OGNL root is null, then the OGNL root
passed in to the setOgnlRoot() method is used. If that's null,
then the template is returned unchanged.
Parameters: ognlRoot - The OGNL root to use for generating the message. Returns the message, which is constructed based upon the OGNLroot passed in and the template. |
getOgnlRoot | public Object getOgnlRoot()(Code) | | Returns the OGNL root previously set using the setOgnlRoot() method.
Returns the OGNL root for this message. |
getTemplate | public String getTemplate(Locale locale)(Code) | | Returns the template previously set during construction.
Parameters: locale - The locale to use. Returns the template. |
setOgnlRoot | public void setOgnlRoot(Object ognlRoot)(Code) | | Sets the OGNL root to be used when getMessage() is called.
Parameters: ognlRoot - The OGNL root object. |
|
|