org.pf.nls
Class ResourceBundleTextProvider

java.lang.Object
  extended by org.pf.nls.ResourceBundleTextProvider
All Implemented Interfaces:
IExtendedTextProvider, ITextProvider

public class ResourceBundleTextProvider
extends Object
implements IExtendedTextProvider

This is a simple wrapper around a resource bundle to give it the same interface ITextProvider as available for a TextContainer.

Version:
1.0
Author:
M.Duchrow

Constructor Summary
ResourceBundleTextProvider(ResourceBundle bundle)
          Initialize the new instance with default values.
 
Method Summary
 boolean containsNothing()
          Returns true if this text provider holds no text and also its default text provider contains nothing.
 Locale getLocale()
          Returns the locale the underlying resource bundle was created
 Locale[] getLocales()
          Returns the locales for which this text provider has text
 ResourceBundle getResourceBundle()
          Returns the wrapped resource bundle
 String getText(String key)
          Returns the text associated with the given key or null if the key cannot be found.
 void setResourceBundle(ResourceBundle newValue)
          Set the wrapped resource bundle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceBundleTextProvider

public ResourceBundleTextProvider(ResourceBundle bundle)
Initialize the new instance with default values.

Method Detail

getText

public String getText(String key)
Returns the text associated with the given key or null if the key cannot be found.
If the specified key is null then null will be returned.

Specified by:
getText in interface ITextProvider
Parameters:
key - The identifier for the text

containsNothing

public boolean containsNothing()
Returns true if this text provider holds no text and also its default text provider contains nothing.

Specified by:
containsNothing in interface IExtendedTextProvider

getLocales

public Locale[] getLocales()
Returns the locales for which this text provider has text

Specified by:
getLocales in interface IExtendedTextProvider

getLocale

public Locale getLocale()
Returns the locale the underlying resource bundle was created


getResourceBundle

public ResourceBundle getResourceBundle()
Returns the wrapped resource bundle


setResourceBundle

public void setResourceBundle(ResourceBundle newValue)
Set the wrapped resource bundle



Copyright © 2015 Manfred Duchrow Consulting & Software. All rights reserved.