public abstract class ResourceBundleWrapperRT extends java.lang.Object implements ResourceBundleWrapper, SearchSupport
ResourceBundleWrapperRT
provides some of the base
implementation of a ResourceBundleWrapper
for run-time. Any
implementation of a resource bundle wrapper for run-time must extend
this class for proper functioning in the run-time version of the
ResourceBundleManager
Modifier and Type | Class and Description |
---|---|
protected static class |
ResourceBundleWrapperRT.DefaultSearchContext |
protected static class |
ResourceBundleWrapperRT.SearchType
Deprecated.
See class, SearchSupport for new RT search capabilities.
The ordinals are now frozen because of the mapping in DefaultSearchContext.
|
ResourceBundleWrapper.KeyInfo
Modifier and Type | Field and Description |
---|---|
protected ResourceBundleWrapperRT |
_parent |
Constructor and Description |
---|
ResourceBundleWrapperRT() |
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 . |
protected java.util.Set<java.lang.String> |
findKeys(ResourceBundleWrapperRT.SearchType searchType,
java.lang.Object searchTerm)
Returns a set of keys that satisfy the search using the overload,
but with hard-coded param, ignoreCase='false' to preserve legacy behavior.
|
protected java.util.Set<java.lang.String> |
findKeys(java.lang.String searchTypeMeth,
java.lang.Object searchTerm,
boolean ignoreCase)
This is the single pinch-point method that most override classes can extend
to support their own policies and enhancements to the find operations.
|
java.util.Set<java.lang.String> |
findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata) |
java.util.Set<java.lang.String> |
findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata,
boolean ignoreCase)
Gets a Set of keys which exactly match the specified metadata.
|
java.util.Set<java.lang.String> |
findKeysByText(java.lang.String text) |
java.util.Set<java.lang.String> |
findKeysByText(java.lang.String text,
boolean ignoreCase)
Finds the
Set of keys containing an exact match for text |
java.util.Set<java.lang.String> |
findKeysLikeKey(java.lang.String key) |
java.util.Set<java.lang.String> |
findKeysLikeKey(java.lang.String key,
boolean ignoreCase)
Finds the
Set of keys identifying entries whose key
contains the substring key . |
java.util.Set<java.lang.String> |
findKeysLikeMetaData(java.util.Map<java.lang.String,java.lang.String> metadata,
boolean ignoreCase)
Gets a Set of keys which is a contains match for the specified metadata.
|
java.util.Set<java.lang.String> |
findKeysLikeText(java.lang.String text) |
java.util.Set<java.lang.String> |
findKeysLikeText(java.lang.String text,
boolean ignoreCase)
Finds the
Set of keys identifying entries whose translated text
contains the substring text . |
java.lang.String |
getBundleId()
Gets the bundleId associated with this instance of ResourceBundleWrapper
|
java.util.Map<java.lang.String,java.lang.String> |
getChainedKeyValueMap()
Gets the key-value map for the bundle chained with any parent bundles
For example, if the bundle is for BundleA_en_US the parent chain will
include BundleA_en and Bundle
|
java.util.Map<java.lang.String,java.lang.String> |
getChainedKeyValueMapNoOverride() |
ResourceBundleKeyGenerator |
getKeyGenerator()
Gets the key generator to use for making an automatic key name
|
abstract java.util.Map<java.lang.String,java.lang.String> |
getKeyValueMap()
Gets the map of key-values for this bundle.
|
protected java.util.Map<java.lang.String,java.lang.String> |
getMetadataFromParentChain(java.lang.String key) |
protected ResourceBundleWrapperRT |
getParent() |
java.util.List<ResourceBundleWrapperRT> |
getParentChain() |
protected java.util.List<java.lang.String> |
getParentList() |
java.lang.String |
getString(java.lang.String key)
Gets the translated text (value) identified by
key |
protected abstract void |
parse(java.net.URL url) |
boolean |
refreshBundleIfNeeded(java.lang.Exception ex) |
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
ResourceBundleWrapper.addEntry(String,Map) . |
void |
setParentList(java.util.List<java.lang.String> parentList) |
void |
setURL(java.net.URL url) |
java.lang.String |
toString() |
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
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getMetadata, keySet
protected ResourceBundleWrapperRT _parent
public void setURL(java.net.URL url)
public void setBundleId(java.lang.String bundleId)
ResourceBundleWrapper
setBundleId
in interface ResourceBundleWrapper
bundleId
- the id of the bundlepublic java.lang.String getBundleId()
ResourceBundleWrapper
getBundleId
in interface ResourceBundleWrapper
protected abstract void parse(java.net.URL url)
public abstract java.util.Map<java.lang.String,java.lang.String> getKeyValueMap()
public java.util.Set<java.lang.String> findKeysLikeKey(java.lang.String key, boolean ignoreCase)
SearchSupport
Set
of keys identifying entries whose key
contains the substring key
. No wildcards are expected or
allowed.
findKeysLikeKey
in interface SearchSupport
key
- The substring key to matchignoreCase
- True to request case insensitivitySet
of keys containing a match. If no keys match,
then an empty Set
is returned.public java.util.Set<java.lang.String> findKeysByText(java.lang.String text, boolean ignoreCase)
SearchSupport
Set
of keys containing an exact match for text
findKeysByText
in interface SearchSupport
text
- The exact text to matchignoreCase
- True to request case insensitivitySet
of keys containing a match. If no keys match,
then an empty Set
is returnedpublic java.util.Set<java.lang.String> findKeysLikeText(java.lang.String text, boolean ignoreCase)
SearchSupport
Set
of keys identifying entries whose translated text
contains the substring text
. No wildcards are expected or
allowed.
findKeysLikeText
in interface SearchSupport
text
- The substring text to matchignoreCase
- True to request case insensitivitySet
of keys containing a match. If no keys match,
then an empty Set
is returned.public java.util.Set<java.lang.String> findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata, boolean ignoreCase)
SearchSupport
Key | Value | Result |
Key | Value | Result |
findKeysByMetaData
in interface SearchSupport
metadata
- The metadata search criteria.ignoreCase
- True to request case insensitivitySet
is returned.public java.util.Set<java.lang.String> findKeysLikeMetaData(java.util.Map<java.lang.String,java.lang.String> metadata, boolean ignoreCase)
SearchSupport
Key | Value | Result |
Key | Value | Result |
findKeysLikeMetaData
in interface SearchSupport
metadata
- The metadata search criteria.ignoreCase
- True to request case insensitivitySet
is returned.public java.util.Set<java.lang.String> findKeysLikeKey(java.lang.String key)
findKeysLikeKey
in interface ResourceBundleWrapper
key
- The substring key to matchSet
of keys containing a match. If no keys match,
then an empty Set
is returned.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.
public java.util.Set<java.lang.String> findKeysByText(java.lang.String text)
findKeysByText
in interface ResourceBundleWrapper
text
- The exact text to matchSet
of keys containing a match. If no keys match,
then an empty Set
is returnedSearchSupport::findKeysByText(String, boolean)
Finds the {@link Set} of keys containing an exact match for {@code text}
public java.util.Set<java.lang.String> findKeysLikeText(java.lang.String text)
findKeysLikeText
in interface ResourceBundleWrapper
text
- The substring text to matchSet
of keys containing a match. If no keys match,
then an empty Set
is returned.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.
public java.util.Set<java.lang.String> findKeysByMetaData(java.util.Map<java.lang.String,java.lang.String> metadata)
findKeysByMetaData
in interface ResourceBundleWrapper
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
protected java.util.Set<java.lang.String> findKeys(java.lang.String searchTypeMeth, java.lang.Object searchTerm, boolean ignoreCase)
searchTypeMeth
- type of search to performsearchTerm
- term being searched forignoreCase
- whether to _ignoreCase of searchTerm for matchesprotected java.util.Set<java.lang.String> findKeys(ResourceBundleWrapperRT.SearchType searchType, java.lang.Object searchTerm)
searchType
- one of the valid search typessearchTerm
- a text string or a map of strings if a metadata searchpublic void setKeyGenerator(ResourceBundleKeyGenerator generator)
ResourceBundleWrapper
ResourceBundleWrapper.addEntry(String,Map)
.setKeyGenerator
in interface ResourceBundleWrapper
generator
- The ResourceBundleKeyGenerator
to use.
if generator
is null
, then the default key generator
will be used.public ResourceBundleKeyGenerator getKeyGenerator()
ResourceBundleWrapper
getKeyGenerator
in interface ResourceBundleWrapper
public void setParentList(java.util.List<java.lang.String> parentList)
public java.lang.String getString(java.lang.String key)
ResourceBundleWrapper
key
getString
in interface ResourceBundleWrapper
key
- The key in the resource bundleprotected java.util.Map<java.lang.String,java.lang.String> getMetadataFromParentChain(java.lang.String key)
public java.util.Map<java.lang.String,java.lang.String> getChainedKeyValueMap()
public java.util.Map<java.lang.String,java.lang.String> getChainedKeyValueMapNoOverride()
protected ResourceBundleWrapperRT getParent()
public java.util.List<ResourceBundleWrapperRT> getParentChain()
protected java.util.List<java.lang.String> getParentList()
public boolean addEntry(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
ResourceBundleWrapper
addEntry
in interface ResourceBundleWrapper
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 successpublic ResourceBundleOperationResult addEntryNoDialog(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
ResourceBundleWrapper
addEntryNoDialog
in interface ResourceBundleWrapper
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
public java.lang.String addEntry(java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
ResourceBundleWrapper
addEntry
in interface ResourceBundleWrapper
text
- The text to be translated.metadata
- Any associated metadata about the translation string.
This parameter may be null
public boolean deleteEntry(java.lang.String key)
ResourceBundleWrapper
key
. If
key
does not exist, then a value of false
is returned.deleteEntry
in interface ResourceBundleWrapper
key
- The key to deletetrue
If the key is found and deleted success.public boolean updateEntry(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
ResourceBundleWrapper
updateEntry
in interface ResourceBundleWrapper
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 successpublic ResourceBundleOperationResult updateEntryNoDialog(java.lang.String key, java.lang.String text, java.util.Map<java.lang.String,java.lang.String> metadata)
ResourceBundleWrapper
updateEntryNoDialog
in interface ResourceBundleWrapper
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.public void addResourceBundleListener(ResourceBundleListener listener)
ResourceBundleWrapper
listener
to receive ResourceBundleEvent
s
when the contents of the resource bundle change.addResourceBundleListener
in interface ResourceBundleWrapper
listener
- the ResourceBundleListener
to registerResourceBundleListener
,
ResourceBundleEvent
public void removeResourceBundleListener(ResourceBundleListener listener)
ResourceBundleWrapper
listener
that received ResourceBundleEvent
s.removeResourceBundleListener
in interface ResourceBundleWrapper
listener
- the ResourceBundleListener
to removeResourceBundleListener
,
ResourceBundleEvent
public java.lang.String toString()
toString
in class java.lang.Object
public boolean refreshBundleIfNeeded(java.lang.Exception ex)