public interface ResourceBundleWrapper
Modifier and Type | Interface and Description |
---|---|
static class |
ResourceBundleWrapper.KeyInfo |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
addEntry(java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> metadata)
Adds a new entry (value, and optional metadata) into the resource
bundle and returns an automatically generated resource bundle key.
|
boolean |
addEntry(java.lang.String key,
java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> metadata)
Adds a new entry (key, value, and optional metadata) into the
resource bundle.
|
ResourceBundleOperationResult |
addEntryNoDialog(java.lang.String key,
java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> metadata)
Adds a new entry (key, value, and optional metadata) into the
resource bundle.
|
void |
addResourceBundleListener(ResourceBundleListener listener)
Registers a
listener to receive ResourceBundleEvent s
when the contents of the resource bundle change. |
boolean |
deleteEntry(java.lang.String key)
Deletes the resource bundle entry identified by
key . |
java.util.Set<java.lang.String> |
findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata) |
java.util.Set<java.lang.String> |
findKeysByText(java.lang.String text) |
java.util.Set<java.lang.String> |
findKeysLikeKey(java.lang.String key) |
java.util.Set<java.lang.String> |
findKeysLikeText(java.lang.String text) |
java.lang.String |
getBundleId()
Gets the bundleId associated with this instance of ResourceBundleWrapper
|
ResourceBundleKeyGenerator |
getKeyGenerator()
Gets the key generator to use for making an automatic key name
|
java.util.Map<java.lang.String,java.lang.String> |
getMetadata(java.lang.String key)
Gets the translated text (value) identified by
key |
java.lang.String |
getString(java.lang.String key)
Gets the translated text (value) identified by
key |
java.util.Set<java.lang.String> |
keySet()
Returns a set view of the keys contained in this resource bundle.
|
void |
removeResourceBundleListener(ResourceBundleListener listener)
Removes a
listener that received ResourceBundleEvent s. |
void |
setBundleId(java.lang.String bundleId)
Sets the bundleId associated with this instance of ResourceBundleWrapper
|
void |
setKeyGenerator(ResourceBundleKeyGenerator generator)
Sets the key generator to use when using an automatic key name from
addEntry(String,Map) . |
boolean |
updateEntry(java.lang.String key,
java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> metadata)
Updates the specified key to have the specified text and metadata.
|
ResourceBundleOperationResult |
updateEntryNoDialog(java.lang.String key,
java.lang.String text,
java.util.Map<java.lang.String,java.lang.String> metadata)
Updates the specified key to have the specified text and metadata while not
showing any dialog
|
java.lang.String getString(java.lang.String key)
key
key
- The key in the resource bundlejava.lang.NullPointerException
- if the key is null
java.util.MissingResourceException
- If the key not found in the resource
bundle.boolean addEntry(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
key
- The key name to use in the resource bundle.text
- The text to be translated.metadata
- Any associated metadata about the translation string
This parameter may be null
true
on successjava.lang.NullPointerException
- If key
or text
is
null
ResourceBundleOperationResult addEntryNoDialog(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
key
- The key name to use in the resource bundle.text
- The text to be translated.metadata
- Any associated metadata about the translation string
This parameter may be null
java.lang.NullPointerException
- If key
or text
is
null
java.lang.String addEntry(java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
text
- The text to be translated.metadata
- Any associated metadata about the translation string.
This parameter may be null
java.lang.NullPointerException
- If text
is null
boolean deleteEntry(java.lang.String key)
key
. If
key
does not exist, then a value of false
is returned.key
- The key to deletetrue
If the key is found and deleted success.java.lang.NullPointerException
- If key
is null
.boolean updateEntry(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
key
- The key to updatetext
- The new text for the given keymetadata
- Any metadata to change. Existing metadata is merged with
the new metadata, unless there is a key with a null value, then the
existing metadata for that key is removed. If metadata
is
null
then the existing metadata will be unchanged.true
on successjava.lang.NullPointerException
- If key
or text
is null
.ResourceBundleOperationResult updateEntryNoDialog(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
key
- The key to updatetext
- The new text for the given keymetadata
- Any metadata to change. Existing metadata is merged with
the new metadata, unless there is a key with a null value, then the
existing metadata for that key is removed. If metadata
is
null
then the existing metadata will be unchanged.java.lang.NullPointerException
java.util.Set<java.lang.String> findKeysLikeKey(java.lang.String key)
key
- The substring key to matchSet
of keys containing a match. If no keys match,
then an empty Set
is returned.java.lang.NullPointerException
- If key
is null
.SearchSupport::findKeysLikeKey(String,boolean)
Finds the {@link Set} of keys identifying entries whose key
contains the substring {@code key}. No wildcards are expected or
allowed.
java.util.Set<java.lang.String> findKeysByText(java.lang.String text)
text
- The exact text to matchSet
of keys containing a match. If no keys match,
then an empty Set
is returnedjava.lang.NullPointerException
- If text
is null
.SearchSupport::findKeysByText(String, boolean)
Finds the {@link Set} of keys containing an exact match for {@code text}
java.util.Set<java.lang.String> findKeysLikeText(java.lang.String text)
text
- The substring text to matchSet
of keys containing a match. If no keys match,
then an empty Set
is returned.java.lang.NullPointerException
- If text
is null
.SearchSupport::findKeysLikeText(String, boolean)
Finds the {@link Set} of keys identifying entries whose translated text
contains the substring {@code text}. No wildcards are expected or
allowed.
java.util.Set<java.lang.String> findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata)
metadata
- The metadata search criteria.Set
is returned.SearchSupport::findKeysByMetaData(Map, boolean)
,
SearchSupport::findKeysLikeMetaData(Map, boolean)
Gets a Set of keys which contain the specified metadata.
Metadata Search Rules
Key Value Result
Key Value Result
void addResourceBundleListener(ResourceBundleListener listener)
listener
to receive ResourceBundleEvent
s
when the contents of the resource bundle change.listener
- the ResourceBundleListener
to registerjava.lang.NullPointerException
- If listener
is null
.ResourceBundleListener
,
ResourceBundleEvent
void removeResourceBundleListener(ResourceBundleListener listener)
listener
that received ResourceBundleEvent
s.listener
- the ResourceBundleListener
to removejava.lang.NullPointerException
- If listener
is null
.ResourceBundleListener
,
ResourceBundleEvent
void setKeyGenerator(ResourceBundleKeyGenerator generator)
addEntry(String,Map)
.generator
- The ResourceBundleKeyGenerator
to use.
if generator
is null
, then the default key generator
will be used.ResourceBundleKeyGenerator getKeyGenerator()
java.util.Set<java.lang.String> keySet()
Iterator
will throw an UnsupportedOperationException
.java.util.Map<java.lang.String,java.lang.String> getMetadata(java.lang.String key)
key
key
- The key in the resource bundlejava.lang.NullPointerException
- if the key is null
java.util.MissingResourceException
- If the key not found in the resource
bundle.java.lang.String getBundleId()
void setBundleId(java.lang.String bundleId)
bundleId
- the id of the bundle