Class XmlFlow<T>
java.lang.Object
com.norconex.commons.lang.xml.flow.XmlFlow<T>
- Type Parameters:
T- type of the object to be submitted to the flow.
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.
XML Syntax
<!-- 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>
- Since:
- 2.0.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXmlFlow()XmlFlow(Class<? extends XmlFlowConsumerAdapter<T>> consumerAdapter, Class<? extends XmlFlowPredicateAdapter<T>> predicateAdapter) -
Method Summary
Modifier and TypeMethodDescriptionbooleanClass<? extends XmlFlowConsumerAdapter<T>> Class<? extends XmlFlowPredicateAdapter<T>> inthashCode()toString()voidWrites a flow previously constructed byparse(Xml)to XML.
-
Field Details
-
DEFAULT_CONSUMERS_WRITE_TAG_NAME
- See Also:
-
-
Constructor Details
-
XmlFlow
public XmlFlow() -
XmlFlow
public XmlFlow(Class<? extends XmlFlowConsumerAdapter<T>> consumerAdapter, Class<? extends XmlFlowPredicateAdapter<T>> predicateAdapter)
-
-
Method Details
-
getConsumerAdapter
-
getPredicateAdapter
-
parse
-
write
Writes a flow previously constructed byparse(Xml)to XML.- Parameters:
xml- the XML to write toconsumer- the consumer flow to write
-
toString
-
equals
-
hashCode
public int hashCode()
-