| Constructor and Description |
|---|
Predicates() |
| Modifier and Type | Method and Description |
|---|---|
static Predicate<XdmNode> |
attributeEq(String local,
String value)
Obtain a predicate that tests whether an item is an element node with a given attribute (whose
name is in no namespace) whose string value is equal to a given value
|
static <T extends XdmItem> |
empty(Step<T> step)
Obtain a predicate that tests whether a supplied
Step delivers an empty result |
static <T extends XdmItem> |
eq(Step<T> step,
String value)
Obtain a predicate that tests whether there is some item in the result of applying a step,
whose string value is equal to a given string.
|
static Predicate<XdmItem> |
eq(String value)
Obtain a predicate that tests whether the result of applying the XPath string() function to an item
is equal to a given string
|
static Predicate<XdmAtomicValue> |
eq(XdmAtomicValue value)
Obtain a predicate that tests whether an atomic value compares equal to a supplied atomic value of
a comparable type
|
static <T extends XdmItem> |
every(Step<T> step,
Predicate<? super XdmItem> condition)
Obtain a predicate that tests whether every item in the result of applying a step
satisfies the supplied condition.
|
static <T extends XdmItem> |
exists(Step<T> step)
Obtain a predicate that tests whether a supplied Step delivers a non-empty result
|
static Predicate<XdmNode> |
hasAttribute(String local)
Obtain a predicate that tests whether an item is an element node with a given attribute (whose
name is in no namespace)
|
static Predicate<XdmNode> |
hasLocalName(String localName)
Obtain a predicate that tests whether an item is a node with a given local name,
irrespective of the namespace
|
static Predicate<? super XdmNode> |
hasName(String uri,
String localName)
Obtain a predicate that tests whether an item is a node with a given namespace URI and local name
|
static Predicate<XdmNode> |
hasNamespace(String uri)
Obtain a predicate that tests whether an item is a node with a given namespace URI
|
static Predicate<XdmItem> |
hasType(ItemType type)
Obtain a predicate that tests whether an item matches a given item type
|
static Predicate<XdmItem> |
isArray()
A predicate to test whether an item is an XDM array
|
static Predicate<XdmItem> |
isAtomic()
A predicate to test whether an item is an atomic value
|
static Predicate<XdmItem> |
isAttribute()
A predicate to test whether an item is an attribute node
|
static Predicate<XdmItem> |
isComment()
A predicate to test whether an item is a comment node
|
static Predicate<XdmItem> |
isDocument()
A predicate to test whether an item is a document node
|
static Predicate<XdmItem> |
isElement()
A predicate to test whether an item is an element node
|
static Predicate<XdmItem> |
isFunction()
A predicate to test whether an item is a function value (this includes maps and arrays)
|
static Predicate<XdmItem> |
isMap()
A predicate to test whether an item is an XDM map
|
static Predicate<XdmItem> |
isNamespace()
A predicate to test whether an item is a namespace node
|
static Predicate<XdmItem> |
isNode()
A predicate to test whether an item is a node
|
static Predicate<XdmItem> |
isProcessingInstruction()
A predicate to test whether an item is a processing instruction node
|
static Predicate<XdmItem> |
isText()
A predicate to test whether an item is a text node
|
static Predicate<XdmItem> |
matchesRegex(String regex)
Obtain a predicate that tests whether the result of applying the XPath string() function to an item
matches a given regular expression
|
static <T> Predicate<T> |
not(Predicate<T> condition)
|
static <T extends XdmItem> |
some(Step<T> step,
Predicate<? super T> condition)
Obtain a predicate that tests whether there is some item in the result of applying a step that
satisfies the supplied condition.
|
public static Predicate<XdmItem> isNode()
public static Predicate<XdmItem> isElement()
public static Predicate<XdmItem> isAttribute()
public static Predicate<XdmItem> isText()
public static Predicate<XdmItem> isComment()
public static Predicate<XdmItem> isProcessingInstruction()
public static Predicate<XdmItem> isDocument()
public static Predicate<XdmItem> isNamespace()
public static Predicate<XdmItem> isAtomic()
Note: to test for a specific type of atomic value, use a predicate such as
hasType(ItemType.XS_INTEGER)
public static Predicate<XdmItem> isFunction()
public static Predicate<XdmItem> isMap()
public static Predicate<XdmItem> isArray()
public static <T extends XdmItem> Predicate<XdmItem> empty(Step<T> step)
Step delivers an empty resultstep - a step to be applied to the item being testedempty(attribute("id") is a predicate that returns true for a node that
has no "id" attribute. Similarly CHILD.where(empty(child(IS_ELEMENT))) is a step
that selects child elements having no element children.public static <T> Predicate<T> not(Predicate<T> condition)
T - The type of object to which the predicate is applicablecondition - the supplied predicatepublic static <T extends XdmItem> Predicate<XdmItem> exists(Step<T> step)
step - a step to be applied to the item being testedexists(attribute("id") is a
predicate that returns true for a node that has an "id" attribute. So
CHILD.where(exists(attribute("id")) is a step that selects child elements
having an "id" attribute.public static Predicate<? super XdmNode> hasName(String uri, String localName)
uri - the required namespace URI: supply a zero-length string to indicate the null namespacelocalName - the required local namepublic static Predicate<XdmNode> hasLocalName(String localName)
localName - the required local name. If a zero-length string is supplied, the predicate
will match nodes having no name (for example, comments and text nodes)public static Predicate<XdmNode> hasNamespace(String uri)
uri - the required namespace URI: supply a zero-length string to identify the null namespacepublic static Predicate<XdmNode> hasAttribute(String local)
local - the required attribute namepublic static Predicate<XdmNode> attributeEq(String local, String value)
local - the required attribute namevalue - the required attribute valuepublic static Predicate<XdmItem> hasType(ItemType type)
type - the required item typehasType(ItemType.DATE_TIME) matches atomic values of type
xs:dateTime.public static <T extends XdmItem> Predicate<XdmItem> some(Step<T> step, Predicate<? super T> condition)
For example, some(CHILD, exists(attribute("foo")) matches an element if it has a child
element with an attribute whose local name is "foo".
If the step returns an empty sequence the result will always be false.
step - the step to be evaluatedcondition - the predicate to be applied to the items returned by the steppublic static <T extends XdmItem> Predicate<XdmItem> every(Step<T> step, Predicate<? super XdmItem> condition)
For example, every(CHILD, exists(attribute("foo")) matches an element if each of its child
elements has an attribute whose local name is "foo".
If the step returns an empty sequence the result will always be true.
step - the step to be evaluatedcondition - the predicate to be applied to the items returned by the steppublic static Predicate<XdmAtomicValue> eq(XdmAtomicValue value)
value - the atomic value to be compared withpublic static Predicate<XdmItem> eq(String value)
value - the string being testedpublic static Predicate<XdmItem> matchesRegex(String regex)
regex - the regular expression (this is a Java regular expression, not an XPath regular expression)public static <T extends XdmItem> Predicate<XdmItem> eq(Step<T> step, String value)
For example, eq(attribute("id"), "foo") matches an element if it has an "id"
attribute whose value is "foo".
step - the step to be evaluatedvalue - the string to be compared against the items returned by the step