| java.lang.Object org.jaffa.util.MessageHelper
MessageHelper | public class MessageHelper (Code) | | This is a helper class for getting messages from the Resource. It also performs token replacement
author: GautamJ |
Method Summary | |
public static String | findMessage(String key, Object[] args) Gets the message for the input key from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
It uses the locale for the user from the thread variable, if available, else it uses the default locale for the JVM.
It will also perform token replacement. | public static String | findMessage(Locale locale, String key, Object[] args) Gets the message for the input key from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
It will also perform token replacement. | public static String | findMessage(PageContext pageContext, String key, Object[] args) Gets the message for the input key from the resources (an attribute in the request stream). | public static String | findMessage(PageContext pageContext, String resources, String locale, String key, Object[] args) Gets the message for the input key from the resources (an attribute in the request stream). | public static String | findMessage(MessageResources resources, Locale locale, String key, Object[] args) Gets the message for the input key from the resources. | public static boolean | hasTokens(String input) Returns a true if the input String consists of a tokenized string. | public static String | removeTokenMarkers(String input) This is a convenience method to remove the token markers from the input string.
This method will remove the markers at the beginning and at the end of the string only.
Otherwise it'll simply return the input as is.
Parameters: input - The string from which the token markers are to be removed. | public static String | replaceTokens(String message) Replace the tokens in the input message with appropriate values from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
It uses the locale for the user from the thread variable, if available, else it uses the default locale for the JVM.
If the value for a token, is again a token, then it will recursively find the value.
Parameters: message - Message to be looked up for token replacement. | public static String | replaceTokens(Locale locale, String message) Replace the tokens in the input message with appropriate values from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
If the value for a token, is again a token, then it will recursively find the value.
Parameters: locale - the Locale to be used when looking up the ResourceBundle. Parameters: message - Message to be looked up for token replacement. | public static String | replaceTokens(PageContext pageContext, String message) Replace the tokens in the input message with appropriate values from the resources (an attribute in the request stream).
This uses the default struts MessageResources and Locale.
If the value for a token, is again a token, then it will recursively find the value.
Parameters: pageContext - The servlet pageContext we are processing. Parameters: message - Message to be looked up for token replacement. | public static String | replaceTokens(PageContext pageContext, String resources, String locale, String message) Replace the tokens in the input message with appropriate values from the resources (an attribute in the request stream).
If the value for a token, is again a token, then it will recursively find the value.
Parameters: pageContext - The servlet pageContext we are processing. Parameters: resources - The key that identifies that the MessageResources object in the pageContext Parameters: locale - The key that identifies that the Locale object in the pageContext Parameters: message - Message to be looked up for token replacement. | public static String | replaceTokens(MessageResources resources, Locale locale, String message) Replace the tokens in the input message with appropriate values from the resources.
If the value for a token, is again a token, then it will recursively find the value.
Note: Ensure that are no cyclic references from one token to another to the first token.
Parameters: resources - The underlying resource bundle to look at. Parameters: locale - The requested message Locale. Parameters: message - Message to be looked up for token replacement. | public static String | tokenize(String input) This will add the Token Markers around the input String.
Parameters: input - the string to be tokenized. |
findMessage | public static String findMessage(String key, Object[] args)(Code) | | Gets the message for the input key from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
It uses the locale for the user from the thread variable, if available, else it uses the default locale for the JVM.
It will also perform token replacement.
Parameters: key - The key of the the message to be looked up. Parameters: args - An array of arguments to be added to the message. the message with the tokens replaced. |
findMessage | public static String findMessage(Locale locale, String key, Object[] args)(Code) | | Gets the message for the input key from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
It will also perform token replacement.
Parameters: locale - the Locale to be used when looking up the ResourceBundle. Parameters: key - The key of the the message to be looked up. Parameters: args - An array of arguments to be added to the message. the message with the tokens replaced. |
findMessage | public static String findMessage(PageContext pageContext, String key, Object[] args)(Code) | | Gets the message for the input key from the resources (an attribute in the request stream). It will also perform token replacement.
This uses the default struts MessageResources and Locale.
Parameters: pageContext - The servlet pageContext we are processing. Parameters: key - The key of the the message to be looked up. Parameters: args - An array of arguments to be added to the message. the message with the tokens replaced. |
findMessage | public static String findMessage(PageContext pageContext, String resources, String locale, String key, Object[] args)(Code) | | Gets the message for the input key from the resources (an attribute in the request stream). It will also perform token replacement.
Parameters: pageContext - The servlet pageContext we are processing. Parameters: resources - The key that identifies that the MessageResources object in the pageContext Parameters: locale - The key that identifies that the Locale object in the pageContext Parameters: key - The key of the the message to be looked up. Parameters: args - An array of arguments to be added to the message. the message with the tokens replaced. |
findMessage | public static String findMessage(MessageResources resources, Locale locale, String key, Object[] args)(Code) | | Gets the message for the input key from the resources. It will also perform token replacement.
Parameters: resources - The underlying resource bundle to look at. Parameters: locale - The requested message Locale. Parameters: key - The key of the the message to be looked up. Parameters: args - An array of arguments to be added to the message. the message with the tokens replaced. |
hasTokens | public static boolean hasTokens(String input)(Code) | | Returns a true if the input String consists of a tokenized string.
Parameters: input - the string to be checked for presence of tokens a true if the input String consists of a tokenized string. |
removeTokenMarkers | public static String removeTokenMarkers(String input)(Code) | | This is a convenience method to remove the token markers from the input string.
This method will remove the markers at the beginning and at the end of the string only.
Otherwise it'll simply return the input as is.
Parameters: input - The string from which the token markers are to be removed. The input string minus its outer token markers, if any. |
replaceTokens | public static String replaceTokens(String message)(Code) | | Replace the tokens in the input message with appropriate values from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
It uses the locale for the user from the thread variable, if available, else it uses the default locale for the JVM.
If the value for a token, is again a token, then it will recursively find the value.
Parameters: message - Message to be looked up for token replacement. the message with the tokens replaced. |
replaceTokens | public static String replaceTokens(Locale locale, String message)(Code) | | Replace the tokens in the input message with appropriate values from the default resources, as specified in the 'framework.messageResources.bundle' property of framework.properties files.
A null will be returned in case an invalid or if no ResourceBundle is specified in the 'framework.messageResources.bundle' property of framework.properties file.
If the value for a token, is again a token, then it will recursively find the value.
Parameters: locale - the Locale to be used when looking up the ResourceBundle. Parameters: message - Message to be looked up for token replacement. the message with the tokens replaced. |
replaceTokens | public static String replaceTokens(PageContext pageContext, String message)(Code) | | Replace the tokens in the input message with appropriate values from the resources (an attribute in the request stream).
This uses the default struts MessageResources and Locale.
If the value for a token, is again a token, then it will recursively find the value.
Parameters: pageContext - The servlet pageContext we are processing. Parameters: message - Message to be looked up for token replacement. the message with the tokens replaced. |
replaceTokens | public static String replaceTokens(PageContext pageContext, String resources, String locale, String message)(Code) | | Replace the tokens in the input message with appropriate values from the resources (an attribute in the request stream).
If the value for a token, is again a token, then it will recursively find the value.
Parameters: pageContext - The servlet pageContext we are processing. Parameters: resources - The key that identifies that the MessageResources object in the pageContext Parameters: locale - The key that identifies that the Locale object in the pageContext Parameters: message - Message to be looked up for token replacement. the message with the tokens replaced. |
replaceTokens | public static String replaceTokens(MessageResources resources, Locale locale, String message)(Code) | | Replace the tokens in the input message with appropriate values from the resources.
If the value for a token, is again a token, then it will recursively find the value.
Note: Ensure that are no cyclic references from one token to another to the first token.
Parameters: resources - The underlying resource bundle to look at. Parameters: locale - The requested message Locale. Parameters: message - Message to be looked up for token replacement. the message with the tokens replaced. |
tokenize | public static String tokenize(String input)(Code) | | This will add the Token Markers around the input String.
Parameters: input - the string to be tokenized. the string with the Token Markers around it. A null is returned if the input is null. If the input begins or ends with the token marker, then it will be returned as is. |
|
|