public final class Dictionary extends Object
Dictionary
is
bound to a named JavaScript object that resides in the global namespace of
the host page's window object. The bound JavaScript object is used directly
as an associative array.
For example, suppose you define the following JavaScript object in your host
page:
You can then use a Dictionary
to access the key/value pairs
above:
Unlike the family of interfaces that extend
Localizable
which support static
internationalization, the Dictionary
class is fully dynamic.
As a result, a variety of error conditions (particularly those involving key
mismatches) cannot be caught until runtime. Similarly, the GWT compiler is
unable discard unused dictionary values since the structure cannot be
statically analyzed.
locale
client property. Thus,
Dictionary
is the most flexible of the internationalization
types and may provide the simplest form of integration with existing
localization systems which were not specifically designed to use GWT's
locale
client property.
See Localizable
for background on the
locale
client property.
com.google.gwt.i18n.I18N
.
Modifier and Type | Method and Description |
---|---|
String |
get(String key)
Get the value associated with the given Dictionary key.
|
static Dictionary |
getDictionary(String name)
Returns the
Dictionary object associated with the given
name. |
Set<String> |
keySet()
The set of keys associated with this dictionary.
|
String |
toString() |
Collection<String> |
values()
Collection of values associated with this dictionary.
|
public static Dictionary getDictionary(String name)
Dictionary
object associated with the given
name.name
- MissingResourceException
public String get(String key)
key
- to lookupMissingResourceException
- if the value is not foundpublic Set<String> keySet()
public Collection<String> values()
Copyright © 2018. All rights reserved.