org.rhq.core.domain.util
Class DisambiguationReportRenderer
java.lang.Object
org.rhq.core.domain.util.DisambiguationReportRenderer
public class DisambiguationReportRenderer
- extends Object
This class can be used to produce a "pretty" textual representation of a DisambiguationReport
.
It supports a simple templating mechanism to configure the representation's format.
In the DisambiguationReport
, a resource (either the resource being disambiguated or one of its parents)
is represented by an instance of DisambiguationReport.Resource
. The template uses this instance and its
properties:
- id - the resource id
- name - the name of the resource
- type - the type of the resource
- name - the name of the resource type
- plugin - the name of the plugin defining the resource type
- singleton - a boolean whether the resource type is a singleton type or not
The template has the following format:
...text...%([..text...])?<identifier>([...text...])?...text...
It is best explained by an example. The default segment template
looks like this:
%type.name[ ]%[(]type.plugin[) ]%name
The %type.name[ ]
is rendered as the name of the resource type followed by a space IF the
resource type and the name are not null. If either of them is null %type.name[ ]
renders as an
empty string.
%[(]type.plugin[) ]
renders as a bracket followed by the name of the plugin followed by a bracket and
a space if both resource type and plugin are not null. If either of them is null, again the whole %...
is
rendered as an empty string.
The escape character is \.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEFAULT_SEGMENT_TEMPLATE
public static final String DEFAULT_SEGMENT_TEMPLATE
- See Also:
- Constant Field Values
DEFALUT_SEGMENT_SEPARATOR
public static final String DEFALUT_SEGMENT_SEPARATOR
- See Also:
- Constant Field Values
DisambiguationReportRenderer
public DisambiguationReportRenderer()
isIncludeResource
public boolean isIncludeResource()
- Returns:
- the includeResource
setIncludeResource
public void setIncludeResource(boolean includeResource)
- Parameters:
includeResource
- the includeResource to set
isIncludeParents
public boolean isIncludeParents()
- Returns:
- the includeParents
setIncludeParents
public void setIncludeParents(boolean includeParents)
- Parameters:
includeParents
- the includeParents to set
getRenderingOrder
public DisambiguationReportRenderer.RenderingOrder getRenderingOrder()
- Returns:
- the renderingOrder
setRenderingOrder
public void setRenderingOrder(DisambiguationReportRenderer.RenderingOrder renderingOrder)
- Parameters:
renderingOrder
- the renderingOrder to set
getSegmentTemplate
public String getSegmentTemplate()
- Returns:
- the segmentTemplate
setSegmentTemplate
public void setSegmentTemplate(String segmentTemplate)
- Parameters:
segmentTemplate
- the segmentTemplate to set
getSingletonSegmentTemplate
public String getSingletonSegmentTemplate()
- Returns:
- the singletonSegmentTemplate
setSingletonSegmentTemplate
public void setSingletonSegmentTemplate(String singletonSegmentTemplate)
- Parameters:
singletonSegmentTemplate
- the singletonSegmentTemplate to set
getSegmentSeparator
public String getSegmentSeparator()
- Returns:
- the segmentSeparator
setSegmentSeparator
public void setSegmentSeparator(String segmentSeparator)
- Parameters:
segmentSeparator
- the segmentSeparator to set
render
public String render(DisambiguationReport<?> report)
Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.