Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.opensymphony.xwork2
Class CompositeTextProvider

    java.lang.Object
      com.opensymphony.xwork2.CompositeTextProvider

All Implemented Interfaces:
  TextProvider

    public class CompositeTextProvider

extends java.lang.Object
implements TextProvider

This is a composite `TextProvider` that takes in an array or `List` of `TextProvider`s, it will consult each of them in order to get a composite result. To know how each method behaves, please refer to the javadoc for each methods.

Version:
  $Date: 2011-03-03 18:48:32 +0100 (Thu, 03 Mar 2011) $ $Id: CompositeTextProvider.java 1076704 2011-03-03 17:48:32Z lukaszlenart $
Author:
  tmjee

Constructor Summary
`CompositeTextProvider(java.util.List<TextProvider> textProviders)` Instantiates a `CompositeTextProvider` with some predefined `textProviders`.
`CompositeTextProvider(TextProvider[] textProviders)` Instantiates a `CompositeTextProvider` with some predefined `textProviders`.

Method Summary
`java.lang.String` | `getText(java.lang.String key)` It will consult each `TextProvider`s and return the first valid message for this `key`
`java.lang.String` | `getText(java.lang.String key, java.util.List<?> args)` It will consult each `TextProvider`s and return the first valid message for this `key`.
`java.lang.String` | `getText(java.lang.String key, java.lang.String defaultValue)` It will consult each `TextProvider`s and return the first valid message for this `key` before returning `defaultValue` if every else fails.
`java.lang.String` | `getText(java.lang.String key, java.lang.String[] args)` It will consult each `TextProvider`s and return the first valid message for this `key`.
`java.lang.String` | `getText(java.lang.String key, java.lang.String defaultValue, java.util.List<?> args)` It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`
`java.lang.String` | `getText(java.lang.String key, java.lang.String defaultValue, java.util.List<?> args, ValueStack stack)` It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`
`java.lang.String` | `getText(java.lang.String key, java.lang.String defaultValue, java.lang.String obj)` It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue` if every else fails.
`java.lang.String` | `getText(java.lang.String key, java.lang.String defaultValue, java.lang.String[] args)` It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`.
`java.lang.String` | `getText(java.lang.String key, java.lang.String defaultValue, java.lang.String[] args, ValueStack stack)` It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`
`java.util.ResourceBundle` | `getTexts()` It will consult each `TextProvider`s and return the first non-null `ResourceBundle`.
`java.util.ResourceBundle` | `getTexts(java.lang.String bundleName)` It will consult each `TextProvider`s and return the first non-null `ResourceBundle`.
`boolean` | `hasKey(java.lang.String key)` Checks if a message key exists.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CompositeTextProvider

    public CompositeTextProvider(java.util.List<TextProvider> textProviders)

  Instantiates a `CompositeTextProvider` with some predefined `textProviders`.

  Parameters:
    `textProviders` -

### CompositeTextProvider

    public CompositeTextProvider(TextProvider[] textProviders)

  Instantiates a `CompositeTextProvider` with some predefined `textProviders`.

  Parameters:
    `textProviders` -

Method Detail

### hasKey

    public boolean hasKey(java.lang.String key)

  Description copied from interface: `TextProvider`
  Checks if a message key exists.

  Specified by:
    `hasKey` in interface `TextProvider`
  Parameters:
    `key` - The key to lookup in ressource bundles.
  Returns:
    `true`, if the requested key is found in one of the ressource bundles.
  See Also:
    `com.opensymphony.xwork2.TextProvider#hasKey(String)} It will consult each individual {@link TextProvider}s and return true if either one of the {@link TextProvider} has such a `key>` else false.`

### getText

    public java.lang.String getText(java.lang.String key)

  It will consult each `TextProvider`s and return the first valid message for this `key`

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` - The key to lookup in ressource bundles.
  Returns:
    The i18n text for the requested key.
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String)}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.lang.String defaultValue)

  It will consult each `TextProvider`s and return the first valid message for this `key` before returning `defaultValue` if every else fails.

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `defaultValue` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String, String)}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.lang.String defaultValue,
                                    java.lang.String obj)

  It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue` if every else fails.

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `defaultValue` -
    `obj` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String, String, String)}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.util.List<?> args)

  It will consult each `TextProvider`s and return the first valid message for this `key`.

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `args` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String, java.util.List)}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.lang.String[] args)

  It will consult each `TextProvider`s and return the first valid message for this `key`.

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `args` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String, String[])}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.lang.String defaultValue,
                                    java.util.List<?> args)

  It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `defaultValue` -
    `args` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText#getText(String, String, java.util.List)}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.lang.String defaultValue,
                                    java.lang.String[] args)

  It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`.

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `defaultValue` -
    `args` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String, String, String[])}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.lang.String defaultValue,
                                    java.util.List<?> args,
                                    ValueStack stack)

  It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `defaultValue` -
    `args` -
    `stack` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String, String, java.util.List, com.opensymphony.xwork2.util.ValueStack)}`

### getText

    public java.lang.String getText(java.lang.String key,
                                    java.lang.String defaultValue,
                                    java.lang.String[] args,
                                    ValueStack stack)

  It will consult each `TextProvider`s and return the first valid message for this `key`, before returining `defaultValue`

  Specified by:
    `getText` in interface `TextProvider`
  Parameters:
    `key` -
    `defaultValue` -
    `args` -
    `stack` -
  Returns:
  See Also:
    `com.opensymphony.xwork2.TextProvider#getText(String, String, String[], com.opensymphony.xwork2.util.ValueStack)}`

### getTexts

    public java.util.ResourceBundle getTexts(java.lang.String bundleName)

  It will consult each `TextProvider`s and return the first non-null `ResourceBundle`.

  Specified by:
    `getTexts` in interface `TextProvider`
  Parameters:
    `bundleName` -
  Returns:
  See Also:
    `TextProvider#getTexts(String)}`

### getTexts

    public java.util.ResourceBundle getTexts()

  It will consult each `TextProvider`s and return the first non-null `ResourceBundle`.

  Specified by:
    `getTexts` in interface `TextProvider`
  Returns:
  See Also:
    `TextProvider#getTexts()}`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.