Package com.onwbp.adaptation
Class XPathFilter
java.lang.Object
com.onwbp.adaptation.XPathFilter
Defines an XPath predicate. The factory methods allow
internal caching for a better performance.
Code sample:
XPathFilter xpf = XPathFilter.newFilter("./field=$param"); Request request = tableA.createRequest(); request.setXPathFilter(xpf); request.setXPathParameter("param", "A"); request.execute(); request = tableB.createRequest(); request.setXPathFilter(xpf); request.setXPathParameter("param", "B"); request.execute();
-
Method Summary
Modifier and TypeMethodDescriptionstatic XPathFilter
Builds an XPath filter.static XPathFilter
Builds a cache-enabled XPath predicate.toString()
void
validateForTableNode
(SchemaNode aTableNode) Checks if a predicate expression is valid according to the schema of the table.
-
Method Details
-
newFilter
Builds a cache-enabled XPath predicate.This method is equivalent to:
XPathFilter.newFilter(true, aPredicateExpression);
Warning: if many cached predicates with quite specific values are cached, and are not often reused, the memory cost could counter-balance the performance gain.
- See Also:
-
newFilter
Builds an XPath filter.Performance considerations: If the specified predicate must be often reused by multiple
Request
objects, it is recommended to enable caching. Parameterized expressions also help reuse.Warning: however, if many cached predicates with quite specific values are cached (
isCached = true
), but are not reused often, the memory cost could counter-balance the performance gain. More specifically, if a predicate is used only once, it is not recommended to use caching.- Parameters:
isCached
- Iftrue
, the filter is cached in order to be reused when the same predicate expression is applied. Iffalse
, the filter is not cached and thus it cannot be reused.aPredicateExpression
- XPath predicate expression to apply to the table records.- See Also:
-
getPredicateExpression
-
validateForTableNode
public void validateForTableNode(SchemaNode aTableNode) throws IllegalArgumentException, MalformedXPathExpressionException Checks if a predicate expression is valid according to the schema of the table.- Throws:
IllegalArgumentException
- if the specified argument is not defined or if the specified argument is not a table node.MalformedXPathExpressionException
- if the predicate is malformed or if the predicate is not valid according to the schema of the table.- Since:
- 5.8.0
- See Also:
-
toString
-