java.lang.Object
dev.metaschema.core.qname.QNameCache
Provides a cache for managing commonly reused qualified names, represented
using the
IEnhancedQName interface.
The cache operations provided by this cache are thread safe.
A unique integer index value is assigned for each namespace and localname
pair. This index value can be used to retrieve the qualified name using the
get(int) method. This allows the index value to be used in place of
the actual qualified name.
The IEnhancedQName.getIndexPosition() method can be used to get the
index value of a given qualified name.
-
Method Summary
Modifier and TypeMethodDescriptioncachedQNameFor(String namespace, String name) Get a cached qualified name based on the provided namespace and name.get(int index) Get an existing qualified name from the cache that is assigned to the provided index value.static QNameCacheinstance()Get the singleton qualified name cache.
-
Method Details
-
instance
Get the singleton qualified name cache.- Returns:
- the singleton instance
-
cachedQNameFor
Get a cached qualified name based on the provided namespace and name.The qualified name will be added to the cache if it doesn't already exist.
- Parameters:
namespace- the namespace for the new qualified namename- the local name for the new qualified name- Returns:
- the new cached qualified name or the existing cached name if it already exists in the cache
-
get
Get an existing qualified name from the cache that is assigned to the provided index value.Note: There is a chance that an entry associated index value may not exist at first, but subsequent calls may find an associated value in the future if one is created with that value.
- Parameters:
index- the index value for the qualified name- Returns:
- the cached qualified name or
nullif a cache entry does not exist for the index value
-