org.xbrlapi.aspects
Class MemoryLabelCache
java.lang.Object
org.xbrlapi.aspects.MemoryLabelCache
- All Implemented Interfaces:
- Serializable, LabelCache
public class MemoryLabelCache
- extends Object
- implements LabelCache
Provides an in-memory label caching system.
This is really only useful for unit-testing purposes.
- Author:
- Geoff Shuetrim (geoff@galexy.net)
- See Also:
- Serialized Form
|
Field Summary |
protected static org.apache.log4j.Logger |
logger
|
|
Method Summary |
void |
cacheLabel(Class<?> labellerClass,
URI aspectId,
String valueId,
String locale,
URI resourceRole,
URI linkRole,
String label,
boolean isFallbackLabel)
Caches the given label, replacing earlier versions of such label in the cache to
ensure that there is only ever one label in the cache that matches the selection
criteria. |
String |
getLabel(Class<?> labellerClass,
URI aspectId,
String valueId,
String locale,
URI resourceRole,
URI linkRole)
|
String |
getLabelWithoutFallback(Class<?> labellerClass,
URI aspectId,
String valueId,
String locale,
URI resourceRole,
URI linkRole)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected static final org.apache.log4j.Logger logger
MemoryLabelCache
public MemoryLabelCache()
getLabel
public String getLabel(Class<?> labellerClass,
URI aspectId,
String valueId,
String locale,
URI resourceRole,
URI linkRole)
throws XBRLException
- Specified by:
getLabel in interface LabelCache
aspectId - the ID of the aspect - must not be null.valueId - The id of the aspect value - must not be null.locale - The XML language code - can be null.resourceRole - The label resource role - can be null.linkRole - The link role for the extended link containing the label - can be null.
- Returns:
- the label matching the parameters or null if there is no such label in the cache.
- Throws:
XBRLException- See Also:
LabelCache.getLabel(Class, URI, String, String, URI, URI)
getLabelWithoutFallback
public String getLabelWithoutFallback(Class<?> labellerClass,
URI aspectId,
String valueId,
String locale,
URI resourceRole,
URI linkRole)
throws XBRLException
- Specified by:
getLabelWithoutFallback in interface LabelCache
aspectId - the ID of the aspect - must not be null.valueId - The id of the aspect value - must not be null.locale - The XML language code - can be null.resourceRole - The label resource role - can be null.linkRole - The link role for the extended link containing the label - can be null.
- Returns:
- the label matching the parameters or null if there is no such label in the cache.
Fallback labels (those generated by a superclass of the specified aspect labeller) are not returned.
- Throws:
XBRLException- See Also:
LabelCache.getLabelWithoutFallback(Class, URI, String, String, URI, URI)
cacheLabel
public void cacheLabel(Class<?> labellerClass,
URI aspectId,
String valueId,
String locale,
URI resourceRole,
URI linkRole,
String label,
boolean isFallbackLabel)
- Description copied from interface:
LabelCache
- Caches the given label, replacing earlier versions of such label in the cache to
ensure that there is only ever one label in the cache that matches the selection
criteria.
- Specified by:
cacheLabel in interface LabelCache
aspectId - the ID of the aspect - must not be null.valueId - The id of the aspect value - must not be null.locale - The XML language code - can be null.resourceRole - The label resource role - can be null.linkRole - The link role for the extended link containing the label - can be null.label - The label to cache - must not be null.isFallbackLabel - true if the label is a fallback label and false otherwise.- See Also:
LabelCache.cacheLabel(Class, URI, String, String, URI, URI, String, boolean)