public final class XPathFilter extends Object
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();
newFilter(String),
Request.setXPathFilter(XPathFilter),
Request.setXPathParameter(String, Object),
Supported XPath syntax| Modifier and Type | Method and Description |
|---|---|
String |
getPredicateExpression() |
static XPathFilter |
newFilter(boolean isCached,
String aPredicateExpression)
Builds an XPath filter.
|
static XPathFilter |
newFilter(String aPredicateExpression)
Builds a cache-enabled XPath predicate.
|
String |
toString() |
void |
validateForTableNode(SchemaNode aTableNode)
Checks if a predicate expression is valid according to the schema of the table.
|
public static XPathFilter newFilter(String aPredicateExpression)
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.
Request.setXPathFilter(XPathFilter)public static XPathFilter newFilter(boolean isCached, String aPredicateExpression)
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.
isCached - If true, the filter is cached in order to be reused when
the same predicate expression is applied.
If false, the filter is not cached and thus it cannot be reused.aPredicateExpression - XPath predicate expression to apply to the table records.Request.setXPathFilter(XPathFilter)public String getPredicateExpression()
public void validateForTableNode(SchemaNode aTableNode) throws IllegalArgumentException, MalformedXPathExpressionException
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.newFilter(String),
Request.setXPathFilter(XPathFilter)