org.xbrlapi.aspects
Class CachingLabeller
java.lang.Object
org.xbrlapi.aspects.LabellerImpl
org.xbrlapi.aspects.BaseLabeller
org.xbrlapi.aspects.CachingLabeller
- All Implemented Interfaces:
- Serializable, Labeller
public class CachingLabeller
- extends BaseLabeller
- implements Labeller
A generic aspect labeller that uses a caching system. It is made specific
to a given aspect by setting its labeller property as part of the constructor.
- Author:
- Geoff Shuetrim (geoff@galexy.net)
- See Also:
- Serialized Form
|
Field Summary |
protected static org.apache.log4j.Logger |
logger
|
|
Method Summary |
Labeller |
duplicate()
Duplicates the nested labeller but not the caching system. |
Aspect |
getAspect()
|
String |
getAspectLabel(String locale,
URI resourceRole,
URI linkRole)
|
String |
getAspectLabelWithoutFallback(String locale,
URI resourceRole,
URI linkRole)
|
String |
getAspectValueLabel(AspectValue value,
String locale,
URI resourceRole,
URI linkRole)
|
String |
getAspectValueLabelWithoutFallback(AspectValue value,
String locale,
URI resourceRole,
URI linkRole)
|
Labeller |
getLabeller()
|
| 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
CachingLabeller
public CachingLabeller(LabelCache cache,
Labeller labeller)
throws XBRLException
- Parameters:
cache - The label cache to use.labeller - The labeller to cache labels for.
- Throws:
XBRLException
getLabeller
public Labeller getLabeller()
- Returns:
- The labeller used by this caching labeller to produce the actual
labels prior to being cached.
getAspect
public Aspect getAspect()
- Specified by:
getAspect in interface Labeller- Overrides:
getAspect in class LabellerImpl
- Returns:
- the aspect of the embedded labeller.
- See Also:
Labeller.getAspect()
getAspectLabel
public String getAspectLabel(String locale,
URI resourceRole,
URI linkRole)
- Specified by:
getAspectLabel in interface Labeller- Overrides:
getAspectLabel in class LabellerImpl
- Parameters:
locale - The locale (language code etc) of the label. Set to null if the label is not locale dependent.resourceRole - The resource role of the XLink resource providing the label. Set to null if the label
does not depend on the resource role.linkRole - The link role of the extended link network that is to be analysed to obtain the label. Set to
null if the label does not depend on the link role.
- Returns:
- the label for the aspect based upon the given parameters, falling back to labels generated
by superclass labellers where necessary, eventually using just the aspect ID
if that is all that is available.
- See Also:
Labeller.getAspectLabel(String, URI, URI)
getAspectLabelWithoutFallback
public String getAspectLabelWithoutFallback(String locale,
URI resourceRole,
URI linkRole)
- Specified by:
getAspectLabelWithoutFallback in interface Labeller- Overrides:
getAspectLabelWithoutFallback in class LabellerImpl
- Parameters:
locale - The locale (language code etc) of the label. Set to null if the label is not locale dependent.resourceRole - The resource role of the XLink resource providing the label. Set to null if the label
does not depend on the resource role.linkRole - The link role of the extended link network that is to be analysed to obtain the label. Set to
null if the label does not depend on the link role.
- Returns:
- the label for the aspect based upon the given parameters or null if no such label exists.
- See Also:
Labeller.getAspectLabel(String, URI, URI)
getAspectValueLabel
public String getAspectValueLabel(AspectValue value,
String locale,
URI resourceRole,
URI linkRole)
- Specified by:
getAspectValueLabel in interface Labeller- Overrides:
getAspectValueLabel in class BaseLabeller
- Parameters:
value - The aspect value to get a label for.locale - The locale (language code) of the label. This can be set to
null if the label is not locale dependent.resourceRole - The resource role of the XLink resource providing the label.
This can be set to null if the label does not depend on the
resource role.linkRole - The link role of the extended link network that is to be
analysed to obtain the label. This can be set to null if the
label does not depend on the link role.
- Returns:
- the label for the aspect value based upon the given parameters,
falling back to labels generated by superclass labellers where
necessary, eventually using just the aspect value ID if that is
all that is available.
- See Also:
Labeller.getAspectValueLabel(AspectValue, String, URI, URI)
getAspectValueLabelWithoutFallback
public String getAspectValueLabelWithoutFallback(AspectValue value,
String locale,
URI resourceRole,
URI linkRole)
- Specified by:
getAspectValueLabelWithoutFallback in interface Labeller- Overrides:
getAspectValueLabelWithoutFallback in class LabellerImpl
- Parameters:
value - The aspect value to get a label for.locale - The locale (language code) of the label. This can be set to
null if the label is not locale dependent.resourceRole - The resource role of the XLink resource providing the label.
This can be set to null if the label does not depend on the
resource role.linkRole - The link role of the extended link network that is to be
analysed to obtain the label. This can be set to null if the
label does not depend on the link role.
- Returns:
- the label for the aspect value based upon the given parameters,
without falling back to the label obtained by the superclass, if
no label can be obtained. If no label is obtained, a value of null
is returned.
- See Also:
Labeller.getAspectValueLabel(AspectValue, String, URI, URI)
duplicate
public Labeller duplicate()
throws XBRLException
- Duplicates the nested labeller but not the caching system.
A reference to the same caching system is used by the duplicate
caching labeller.
- Specified by:
duplicate in interface Labeller- Overrides:
duplicate in class LabellerImpl
- Returns:
- a new labeller that is a duplicate of this one.
The aspect is not duplicated (the original is used).
- Throws:
XBRLException - if the labeller does not support duplication.- See Also:
LabellerImpl.duplicate()