org.xbrlapi.aspects
Class LabellerImpl
java.lang.Object
org.xbrlapi.aspects.LabellerImpl
- All Implemented Interfaces:
- Serializable, Labeller
- Direct Known Subclasses:
- BaseLabeller, LocationLabeller, PeriodLabellerQuarters
public class LabellerImpl
- extends Object
- implements Labeller
A generic labeller that returns aspect IDs as the aspect labels
and that returns aspect value IDs as the aspect value labels.
It ignores XLink roles and locales when generating the labels.
Labeller implementations should extend this class.
This labeller can be used for all aspects but it is pretty ordinary in
terms of the quality of the labels it generates.
- Author:
- Geoff Shuetrim (geoff@galexy.net)
- See Also:
- Serialized Form
|
Field Summary |
protected static org.apache.log4j.Logger |
logger
|
|
Method Summary |
Labeller |
duplicate()
|
Aspect |
getAspect()
|
String |
getAspectLabel(String locale,
URI resourceRole,
URI linkRole)
|
String |
getAspectLabelWithoutFallback(String locale,
URI resourceRole,
URI linkRole)
|
String |
getAspectValueLabel(AspectValue value,
List<String> locales,
List<URI> resourceRoles,
List<URI> linkRoles)
|
String |
getAspectValueLabel(AspectValue value,
String locale,
URI resourceRole,
URI linkRole)
|
String |
getAspectValueLabelWithoutFallback(AspectValue value,
String locale,
URI resourceRole,
URI linkRole)
|
Domain |
getDomain()
|
Store |
getStore()
|
| 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
LabellerImpl
public LabellerImpl(Aspect aspect)
throws XBRLException
- Parameters:
aspect - The aspect to be a labeller for.
- Throws:
XBRLException
getAspect
public Aspect getAspect()
- Specified by:
getAspect in interface Labeller
- Returns:
- the aspect that this is a labeller for.
- See Also:
Labeller.getAspect()
getDomain
public Domain getDomain()
- Specified by:
getDomain in interface Labeller
- Returns:
- the domain for the aspect that this is a labeller for.
- See Also:
Labeller.getDomain()
getStore
public Store getStore()
throws XBRLException
- Specified by:
getStore in interface Labeller
- Returns:
- the store underpinning the domain for the aspect that this is a labeller for.
- Throws:
XBRLException- See Also:
Labeller.getStore()
getAspectLabel
public String getAspectLabel(String locale,
URI resourceRole,
URI linkRole)
- Specified by:
getAspectLabel in interface Labeller
- 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
- 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.getAspectLabelWithoutFallback(java.lang.String, java.net.URI, java.net.URI)
getAspectValueLabel
public String getAspectValueLabel(AspectValue value,
String locale,
URI resourceRole,
URI linkRole)
- Specified by:
getAspectValueLabel in interface Labeller
- 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
- 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.getAspectValueLabelWithoutFallback(AspectValue, String, URI, URI)
getAspectValueLabel
public String getAspectValueLabel(AspectValue value,
List<String> locales,
List<URI> resourceRoles,
List<URI> linkRoles)
- Specified by:
getAspectValueLabel in interface Labeller
- Parameters:
value - The aspect value to get the label for.locales - The list of locales, from first (most preferred) to last
(least preferred) or null if locale is not a selection
criterion.resourceRoles - The list of label resource roles, from first (most preferred)
to last (least preferred) or null if resource role is not a
selection criterion.linkRoles - The list of extended link roles, from first (most preferred)
to last (least preferred) or null if link role is not a
selection criterion.
- Returns:
- the label that best fits the selection criteria, falling back to
the label provided by the superclass (eventually this is just the
aspect value ID in a worst case situation).
The selection criteria are prioritised as follows: try hardest to
match locale. After that, try hardest to match resource role. Try
least hard to match the extended link role.
- See Also:
Labeller.getAspectValueLabel(AspectValue, List, List, List)
duplicate
public Labeller duplicate()
throws XBRLException
- Specified by:
duplicate in interface Labeller
- 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:
Labeller.duplicate()