public static class XmlDocumentSourceDescriptor.AttributeBuilder extends Object
XmlDocumentSource
component. You can use this
builder as a type-safe alternative to populating the attribute map using attribute keys.Modifier and Type | Field and Description |
---|---|
Map<String,Object> |
map
The attribute map populated by this builder.
|
Modifier | Constructor and Description |
---|---|
protected |
AttributeBuilder(Map<String,Object> map)
Creates a builder backed by the provided map.
|
Modifier and Type | Method and Description |
---|---|
List<Cluster> |
clusters()
If
XmlDocumentSource.readClusters is true and clusters are present in the input
XML, they will be deserialized and exposed to components further down the processing
chain. |
XmlDocumentSourceDescriptor.AttributeBuilder |
clusters(org.carrot2.util.attribute.IObjectFactory<? extends List<Cluster>> value)
If
XmlDocumentSource.readClusters is true and clusters are present in the input
XML, they will be deserialized and exposed to components further down the processing
chain. |
XmlDocumentSourceDescriptor.AttributeBuilder |
clusters(List<Cluster> value)
If
XmlDocumentSource.readClusters is true and clusters are present in the input
XML, they will be deserialized and exposed to components further down the processing
chain. |
List<Document> |
documents()
Documents read from the XML data.
|
String |
query()
After processing this field may hold the query read from the XML data, if any.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
query(org.carrot2.util.attribute.IObjectFactory<? extends String> value)
After processing this field may hold the query read from the XML data, if any.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
query(String value)
After processing this field may hold the query read from the XML data, if any.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
readAll(boolean value)
If
true , all documents are read from the input XML stream, regardless
of the limit set by XmlDocumentSource.results . |
XmlDocumentSourceDescriptor.AttributeBuilder |
readAll(org.carrot2.util.attribute.IObjectFactory<? extends Boolean> value)
If
true , all documents are read from the input XML stream, regardless
of the limit set by XmlDocumentSource.results . |
XmlDocumentSourceDescriptor.AttributeBuilder |
readClusters(boolean value)
If clusters are present in the input XML they will be read and exposed to components
further down the processing chain.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
readClusters(org.carrot2.util.attribute.IObjectFactory<? extends Boolean> value)
If clusters are present in the input XML they will be read and exposed to components
further down the processing chain.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
results(int value)
The maximum number of documents to read from the XML data if
XmlDocumentSource.readAll is
false . |
XmlDocumentSourceDescriptor.AttributeBuilder |
results(org.carrot2.util.attribute.IObjectFactory<? extends Integer> value)
The maximum number of documents to read from the XML data if
XmlDocumentSource.readAll is
false . |
String |
title()
The title (file name or query attribute, if present) for the search result fetched
from the resource.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xml(Class<?> clazz)
The resource to load XML data from.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xml(org.carrot2.util.attribute.IObjectFactory<? extends IResource> value)
The resource to load XML data from.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xml(IResource value)
The resource to load XML data from.
|
XmlDocumentSourceHelperDescriptor.AttributeBuilder |
xmlDocumentSourceHelper()
Returns an attribute builder for the nested
XmlDocumentSourceHelper component, backed by the same attribute map
as the current builder. |
XmlDocumentSourceDescriptor.AttributeBuilder |
xmlParameters(org.carrot2.util.attribute.IObjectFactory<? extends Map<String,String>> value)
Values for custom placeholders in the XML URL.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xmlParameters(Map<String,String> value)
Values for custom placeholders in the XML URL.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xslt(Class<?> clazz)
The resource to load XSLT stylesheet from.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xslt(org.carrot2.util.attribute.IObjectFactory<? extends IResource> value)
The resource to load XSLT stylesheet from.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xslt(IResource value)
The resource to load XSLT stylesheet from.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xsltParameters(org.carrot2.util.attribute.IObjectFactory<? extends Map<String,String>> value)
Parameters to be passed to the XSLT transformer.
|
XmlDocumentSourceDescriptor.AttributeBuilder |
xsltParameters(Map<String,String> value)
Parameters to be passed to the XSLT transformer.
|
public XmlDocumentSourceDescriptor.AttributeBuilder xml(IResource value)
IResource
implementations directly or use
ResourceLookup
to look up
IResource
instances from a variety of locations.
One special IResource
implementation you can use is
URLResourceWithParams
. It allows you to specify attribute placeholders in
the URL that will be replaced with actual values at runtime. The placeholder format
is ${attribute}
. The following common attributes will be substituted:
query
will be replaced with the current query being processed. If
the query has not been provided, this attribute will fall back to an empty string.results
will be replaced with the number of results requested. If
the number of results has not been provided, this attribute will be substituted
with an empty string.
Additionally, custom placeholders can be used. Values for the custom placeholders
should be provided in the XmlDocumentSource.xmlParameters
attribute.
XmlDocumentSource.xml
public XmlDocumentSourceDescriptor.AttributeBuilder xml(Class<?> clazz)
IResource
implementations directly or use
ResourceLookup
to look up
IResource
instances from a variety of locations.
One special IResource
implementation you can use is
URLResourceWithParams
. It allows you to specify attribute placeholders in
the URL that will be replaced with actual values at runtime. The placeholder format
is ${attribute}
. The following common attributes will be substituted:
query
will be replaced with the current query being processed. If
the query has not been provided, this attribute will fall back to an empty string.results
will be replaced with the number of results requested. If
the number of results has not been provided, this attribute will be substituted
with an empty string.
Additionally, custom placeholders can be used. Values for the custom placeholders
should be provided in the XmlDocumentSource.xmlParameters
attribute.
XmlDocumentSource.xml
public XmlDocumentSourceDescriptor.AttributeBuilder xml(org.carrot2.util.attribute.IObjectFactory<? extends IResource> value)
IResource
implementations directly or use
ResourceLookup
to look up
IResource
instances from a variety of locations.
One special IResource
implementation you can use is
URLResourceWithParams
. It allows you to specify attribute placeholders in
the URL that will be replaced with actual values at runtime. The placeholder format
is ${attribute}
. The following common attributes will be substituted:
query
will be replaced with the current query being processed. If
the query has not been provided, this attribute will fall back to an empty string.results
will be replaced with the number of results requested. If
the number of results has not been provided, this attribute will be substituted
with an empty string.
Additionally, custom placeholders can be used. Values for the custom placeholders
should be provided in the XmlDocumentSource.xmlParameters
attribute.
XmlDocumentSource.xml
public XmlDocumentSourceDescriptor.AttributeBuilder xslt(IResource value)
Document
s.
The XSLT IResource
can be provided both on initialization and processing
time. The stylesheet provided on initialization will be cached for the life time of
the component, while processing-time style sheets will be compiled every time
processing is requested and will override the initialization-time stylesheet.
To pass additional parameters to the XSLT transformer, use the
XmlDocumentSource.xsltParameters
attribute.
XmlDocumentSource.xslt
public XmlDocumentSourceDescriptor.AttributeBuilder xslt(Class<?> clazz)
Document
s.
The XSLT IResource
can be provided both on initialization and processing
time. The stylesheet provided on initialization will be cached for the life time of
the component, while processing-time style sheets will be compiled every time
processing is requested and will override the initialization-time stylesheet.
To pass additional parameters to the XSLT transformer, use the
XmlDocumentSource.xsltParameters
attribute.
XmlDocumentSource.xslt
public XmlDocumentSourceDescriptor.AttributeBuilder xslt(org.carrot2.util.attribute.IObjectFactory<? extends IResource> value)
Document
s.
The XSLT IResource
can be provided both on initialization and processing
time. The stylesheet provided on initialization will be cached for the life time of
the component, while processing-time style sheets will be compiled every time
processing is requested and will override the initialization-time stylesheet.
To pass additional parameters to the XSLT transformer, use the
XmlDocumentSource.xsltParameters
attribute.
XmlDocumentSource.xslt
public XmlDocumentSourceDescriptor.AttributeBuilder xmlParameters(Map<String,String> value)
XmlDocumentSource.xml
attribute is URLResourceWithParams
, this map provides
values for custom placeholders found in the XML URL. Keys of the map correspond to
placeholder names, values of the map will be used to replace the placeholders.
Please see XmlDocumentSource.xml
for the placeholder syntax.XmlDocumentSource.xmlParameters
public XmlDocumentSourceDescriptor.AttributeBuilder xmlParameters(org.carrot2.util.attribute.IObjectFactory<? extends Map<String,String>> value)
XmlDocumentSource.xml
attribute is URLResourceWithParams
, this map provides
values for custom placeholders found in the XML URL. Keys of the map correspond to
placeholder names, values of the map will be used to replace the placeholders.
Please see XmlDocumentSource.xml
for the placeholder syntax.XmlDocumentSource.xmlParameters
public XmlDocumentSourceDescriptor.AttributeBuilder xsltParameters(Map<String,String> value)
XmlDocumentSource.xsltParameters
public XmlDocumentSourceDescriptor.AttributeBuilder xsltParameters(org.carrot2.util.attribute.IObjectFactory<? extends Map<String,String>> value)
XmlDocumentSource.xsltParameters
public XmlDocumentSourceDescriptor.AttributeBuilder query(String value)
XmlDocumentSource.xml
.XmlDocumentSource.query
public XmlDocumentSourceDescriptor.AttributeBuilder query(org.carrot2.util.attribute.IObjectFactory<? extends String> value)
XmlDocumentSource.xml
.XmlDocumentSource.query
public String query()
XmlDocumentSource.xml
.XmlDocumentSource.query
public XmlDocumentSourceDescriptor.AttributeBuilder results(int value)
XmlDocumentSource.readAll
is
false
.XmlDocumentSource.results
public XmlDocumentSourceDescriptor.AttributeBuilder results(org.carrot2.util.attribute.IObjectFactory<? extends Integer> value)
XmlDocumentSource.readAll
is
false
.XmlDocumentSource.results
public XmlDocumentSourceDescriptor.AttributeBuilder readClusters(boolean value)
XmlDocumentSource.readClusters
public XmlDocumentSourceDescriptor.AttributeBuilder readClusters(org.carrot2.util.attribute.IObjectFactory<? extends Boolean> value)
XmlDocumentSource.readClusters
public XmlDocumentSourceDescriptor.AttributeBuilder readAll(boolean value)
true
, all documents are read from the input XML stream, regardless
of the limit set by XmlDocumentSource.results
.XmlDocumentSource.readAll
public XmlDocumentSourceDescriptor.AttributeBuilder readAll(org.carrot2.util.attribute.IObjectFactory<? extends Boolean> value)
true
, all documents are read from the input XML stream, regardless
of the limit set by XmlDocumentSource.results
.XmlDocumentSource.readAll
public String title()
XmlDocumentSource.title
public List<Document> documents()
XmlDocumentSource.documents
public XmlDocumentSourceDescriptor.AttributeBuilder clusters(List<Cluster> value)
XmlDocumentSource.readClusters
is true
and clusters are present in the input
XML, they will be deserialized and exposed to components further down the processing
chain.XmlDocumentSource.clusters
public XmlDocumentSourceDescriptor.AttributeBuilder clusters(org.carrot2.util.attribute.IObjectFactory<? extends List<Cluster>> value)
XmlDocumentSource.readClusters
is true
and clusters are present in the input
XML, they will be deserialized and exposed to components further down the processing
chain.XmlDocumentSource.clusters
public List<Cluster> clusters()
XmlDocumentSource.readClusters
is true
and clusters are present in the input
XML, they will be deserialized and exposed to components further down the processing
chain.XmlDocumentSource.clusters
public XmlDocumentSourceHelperDescriptor.AttributeBuilder xmlDocumentSourceHelper()
XmlDocumentSourceHelper
component, backed by the same attribute map
as the current builder.