WW-4099 updated JavaDoc for getText methods to clearly state that if there is no value found for the provided key then the method should return the provided key.

git-svn-id: https://svn.apache.org/repos/asf/struts/struts2/trunk@1505390 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bruce Allen Phillips
2013-07-21 13:55:36 +00:00
parent 90b51e4381
commit c6fa096bdd
@@ -24,7 +24,7 @@ import java.util.ResourceBundle;
/**
* Provides access to {@link ResourceBundle}s and their underlying text messages.
* Implementing classes can delegate {@link TextProviderSupport}. Messages will be
* searched in multiple resource bundles, startinag with the one associated with
* searched in multiple resource bundles, starting with the one associated with
* this particular class (action in most cases), continuing to try the message
* bundle associated with each superclass as well. It will stop once a bundle is
* found that contains the given text. This gives a cascading style that allow
@@ -39,7 +39,7 @@ import java.util.ResourceBundle;
* <bean class="org.demo.MyTextProvider" name="myTextProvider" type="com.opensymphony.xwork2.TextProvider" />
* <constant name="struts.xworkTextProvider" value="myTextProvider" />
* <p/>
* if you want to also use your implemntation for framework's messages define another constant (remember to put
* if you want to also use your implementation for framework's messages define another constant (remember to put
* into it all framework messages)
* &lt;constant name=&quot;system&quot; value=&quot;myTextProvider&quot; /&gt;
* <p/>
@@ -61,10 +61,11 @@ public interface TextProvider {
boolean hasKey(String key);
/**
* Gets a message based on a message key, or null if no message is found.
* Gets a message based on a message key or if no message is found the provided key
* is returned.
*
* @param key the resource bundle key that is to be searched for
* @return the message as found in the resource bundle, or null if none is found.
* @return the message as found in the resource bundle, or the provided key if none is found.
*/
String getText(String key);
@@ -92,21 +93,21 @@ public interface TextProvider {
/**
* Gets a message based on a key using the supplied args, as defined in
* {@link java.text.MessageFormat}, or null if no message is found.
* {@link java.text.MessageFormat} or the provided key if no message is found.
*
* @param key the resource bundle key that is to be searched for
* @param args a list args to be used in a {@link java.text.MessageFormat} message
* @return the message as found in the resource bundle, or null if none is found.
* @return the message as found in the resource bundle, or the provided key if none is found.
*/
String getText(String key, List<?> args);
/**
* Gets a message based on a key using the supplied args, as defined in
* {@link java.text.MessageFormat}, or null if no message is found.
* {@link java.text.MessageFormat}, or the provided key if no message is found.
*
* @param key the resource bundle key that is to be searched for
* @param args an array args to be used in a {@link java.text.MessageFormat} message
* @return the message as found in the resource bundle, or null if none is found.
* @return the message as found in the resource bundle, or the provided key if none is found.
*/
String getText(String key, String[] args);