public abstract class

AbstractResource

extends Object
java.lang.Object
   ↳ com.google.gwt.i18n.rebind.AbstractResource
Known Direct Subclasses

Class Overview

AbstractResource serves the same purpose as java ResourceBundle/PropertyResourceBundle.

Each Resource belongs to a resource tree, indicated by the path attribute.

AbstractResource uses a Factory pattern rather than a single static method to load itself given an abstract string path.

One advanced feature which should not be used outside the core GWT system is that resources can have more than one parent, for instance pets_en_US could have pets_en as one parent and animals_en_US as another. The alternative parents have lower precedence than any primary parent. Each alternative parent is associated with a separate resource tree.

Summary

Nested Classes
class AbstractResource.MissingResourceException Exception indicating a required resource was not found. 
class AbstractResource.MultipleFormEntry Implementation of ResourceEntry that supports multiple forms per entry. 
interface AbstractResource.ResourceEntry Definition of a single entry for a resource. 
class AbstractResource.ResourceList Encapsulates an ordered set of resources to search for translations. 
class AbstractResource.SimpleEntry A simple resource entry with no alternate forms, only a key and a value. 
Constants
int REPORT_KEYS_THRESHOLD Error messages concerning missing keys should include the defined keys if the number of keys is below this threshold.
Fields
protected GwtLocale matchLocale
Public Constructors
AbstractResource(GwtLocale matchLocale)
Public Methods
AbstractResource.ResourceEntry getEntry(String key)
Returns an entry in this resource.
Collection<String> getExtensions(String key)
final String getRequiredString(String key)
Get a string and fail if not present.
final String getRequiredStringExt(String key, String extension)
Get a string (with optional extension) and fail if not present.
final String getString(String key)
Get a key.
abstract String getStringExt(String key, String extension)
Get a key with an extension.
Set<String> keySet()
Keys associated with this resource.
boolean notEmpty()
Returns true if this resource has any keys.
String toString()
String toVerboseString()
A multi-line representation of this object.
Protected Methods
static String getExtendedKey(String key, String extension)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int REPORT_KEYS_THRESHOLD

Error messages concerning missing keys should include the defined keys if the number of keys is below this threshold.

Constant Value: 30 (0x0000001e)

Fields

protected GwtLocale matchLocale

Public Constructors

public AbstractResource (GwtLocale matchLocale)

Public Methods

public AbstractResource.ResourceEntry getEntry (String key)

Returns an entry in this resource.

Returns
  • ResourceEntry instance

public Collection<String> getExtensions (String key)

public final String getRequiredString (String key)

Get a string and fail if not present.

Returns
  • the requested string

public final String getRequiredStringExt (String key, String extension)

Get a string (with optional extension) and fail if not present.

Returns
  • the requested string

public final String getString (String key)

Get a key.

Parameters
key key to lookup
Returns
  • the string for the given key or null if not found

public abstract String getStringExt (String key, String extension)

Get a key with an extension. Identical to getString() if extension is null.

Parameters
key to lookup
extension extension of the key, nullable
Returns
  • string or null

public Set<String> keySet ()

Keys associated with this resource.

Returns
  • keys

public boolean notEmpty ()

Returns true if this resource has any keys.

public String toString ()

public String toVerboseString ()

A multi-line representation of this object.

Returns
  • verbose string

Protected Methods

protected static String getExtendedKey (String key, String extension)