T
- type of the object to be submitted to the flow.public final class XMLFlow<T> extends Object
Treats an XML block as being a mix of predicate and consumer classes
to create an execution "flow".
The XML syntax below can be used create conditional
Predicate
statements deciding whether to execute or not
Consumer
objects.
<!-- Proceeds if condition is true. -->
<if>
<!--
A single XML "condition" or "conditions" (i.e., condition group).
A condition group accepts an operator. Example:
-->
<conditions
operator="[AND|OR]">
<!--
Unless you have a default implementation configured, "condition"
expects a "class" attribute pointing to a Predicate implementation.
E.g.:
-->
<condition
class="(a Predicate implementation)">
<condition
class="(a Predicate implementation)">
</conditions>
<then>
<!--
Holds one or more XML elements with a "class" attribute pointing to a
Consumer implementation. Executed when above condition or condition
group evaluates to true. Can also contain nested if/ifNot blocks.
-->
</then>
<else>
<!--
Optional. Same as "then" above, but triggered if the condition
evaluates to false. Can also contain nested if/ifNot blocks.
-->
</else>
</if>
<!-- Proceed if condition is false. -->
<ifNot>
<!-- Same as "if" tag -->
</ifNot>
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_CONSUMERS_WRITE_TAG_NAME |
Constructor and Description |
---|
XMLFlow() |
XMLFlow(Class<? extends IXMLFlowConsumerAdapter<T>> consumerAdapter,
Class<? extends IXMLFlowPredicateAdapter<T>> predicateAdapter) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
Class<? extends IXMLFlowConsumerAdapter<T>> |
getConsumerAdapter() |
Class<? extends IXMLFlowPredicateAdapter<T>> |
getPredicateAdapter() |
int |
hashCode() |
Consumer<T> |
parse(XML xml) |
String |
toString() |
void |
write(XML xml,
Consumer<T> consumer)
Writes a flow previously constructed by
parse(XML) to XML. |
public static final String DEFAULT_CONSUMERS_WRITE_TAG_NAME
public XMLFlow()
public XMLFlow(Class<? extends IXMLFlowConsumerAdapter<T>> consumerAdapter, Class<? extends IXMLFlowPredicateAdapter<T>> predicateAdapter)
public Class<? extends IXMLFlowConsumerAdapter<T>> getConsumerAdapter()
public Class<? extends IXMLFlowPredicateAdapter<T>> getPredicateAdapter()
public void write(XML xml, Consumer<T> consumer)
parse(XML)
to XML.xml
- the XML to write toconsumer
- the consumer flow to writeCopyright © 2008–2023 Norconex Inc.. All rights reserved.