org.apache.struts2.util

## Class TextProviderHelper

- java.lang.Object
- - org.apache.struts2.util.TextProviderHelper

-     public class TextProviderHelper
      extends Object

  Helper methods to access text from TextProviders

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextProviderHelper()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getText(String key, String defaultMessage, List<Object> args, ValueStack stack)` Get a message from the first TextProvider encountered in the stack.
    `static String` | `getText(String key, String defaultMessage, List<Object> args, ValueStack stack, boolean searchStack)` Deprecated. The stack should never be searched for the key. Use the version without the searchStack boolean instead.
    `static String` | `getText(String key, String defaultMessage, ValueStack stack)` Get a message from the first TextProvider encountered in the stack.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TextProviderHelper

          public TextProviderHelper()

  - ### Method Detail

    - #### getText

          public static String getText(String key,
                       String defaultMessage,
                       List<Object> args,
                       ValueStack stack)

      Get a message from the first TextProvider encountered in the stack. If the first TextProvider doesn't provide the message the default message is returned.

      The stack is searched if if no TextProvider is found, or the message is not found.
      Parameters:
        `key` - the message key in the resource bundle
        `defaultMessage` - the message to return if not found (evaluated for OGNL)
        `args` - an array args to be used in a `MessageFormat` message
        `stack` - the value stack to use for finding the text
      Returns:
        the message if found, otherwise the defaultMessage

    - #### getText

          @Deprecated
          public static String getText(String key,
                                  String defaultMessage,
                                  List<Object> args,
                                  ValueStack stack,
                                  boolean searchStack)

      Deprecated. The stack should never be searched for the key. Use the version without the searchStack boolean instead.

      Get a message from the first TextProvider encountered in the stack. If the first TextProvider doesn't provide the message the default message is returned.

      The search for a TextProvider is iterative from the root of the stack.

      This method was refactored from `Text` to use a consistent implementation across UIBean components.

      Parameters:
        `key` - the message key in the resource bundle
        `defaultMessage` - the message to return if not found (evaluated for OGNL)
        `args` - an array args to be used in a `MessageFormat` message
        `stack` - the value stack to use for finding the text
        `searchStack` - search stack for the key
      Returns:
        the message if found, otherwise the defaultMessage

    - #### getText

          public static String getText(String key,
                       String defaultMessage,
                       ValueStack stack)

      Get a message from the first TextProvider encountered in the stack. If the first TextProvider doesn't provide the message the default message is returned.

      The search for a TextProvider is iterative from the root of the stack.

      This method was refactored from `Text` to use a consistent implementation across UIBean components.

      Parameters:
        `key` - the message key in the resource bundle
        `defaultMessage` - the message to return if not found
        `stack` - the value stack to use for finding the text
      Returns:
        the message if found, otherwise the defaultMessage

Copyright © 2000–2018 Apache Software Foundation. All rights reserved.