public abstract class AbstractResource extends Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
AbstractResource.MissingResourceException
Exception indicating a required resource was not found.
|
protected static class |
AbstractResource.MultipleFormEntry
Implementation of ResourceEntry that supports multiple forms per entry.
|
static interface |
AbstractResource.ResourceEntry
Definition of a single entry for a resource.
|
static class |
AbstractResource.ResourceList
Encapsulates an ordered set of resources to search for translations.
|
protected static class |
AbstractResource.SimpleEntry
A simple resource entry with no alternate forms, only a key and a value.
|
Modifier and Type | Field and Description |
---|---|
protected GwtLocale |
matchLocale |
static int |
REPORT_KEYS_THRESHOLD
Error messages concerning missing keys should include the defined keys if
the number of keys is below this threshold.
|
Constructor and Description |
---|
AbstractResource(GwtLocale matchLocale) |
Modifier and Type | Method and Description |
---|---|
AbstractResource.ResourceEntry |
getEntry(String key)
Returns an entry in this resource.
|
protected static String |
getExtendedKey(String key,
String extension) |
Collection<String> |
getExtensions(String key) |
String |
getRequiredString(String key)
Get a string and fail if not present.
|
String |
getRequiredStringExt(String key,
String extension)
Get a string (with optional extension) and fail if not present.
|
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.
|
public static final int REPORT_KEYS_THRESHOLD
protected GwtLocale matchLocale
public AbstractResource(GwtLocale matchLocale)
public AbstractResource.ResourceEntry getEntry(String key)
key
- public Collection<String> getExtensions(String key)
key
- public final String getRequiredString(String key)
key
- public final String getRequiredStringExt(String key, String extension)
key
- extension
- public final String getString(String key)
key
- key to lookupResourceBundle.getString(java.lang.String)
public abstract String getStringExt(String key, String extension)
key
- to lookupextension
- extension of the key, nullablepublic boolean notEmpty()
public String toVerboseString()
Copyright © 2016. All rights reserved.