@FunctionalInterface
public interface ElementPredicate
| Modifier and Type | Field | Description |
|---|---|---|
static ElementPredicate |
ANY_ELEMENT |
An element predicate that always returns
true. |
static ElementPredicate |
EMPTY_ELEMENT |
An element predicate that returns
true when the element is empty. |
static ElementPredicate |
PURE_ELEMENT |
An element predicate that returns
true when the element is empty and has no attribute. |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
accepts(Parent parent,
Element element) |
Returns true when an element must be kept.
|
default ElementPredicate |
and(ElementPredicate other) |
Returns a predicate that is the logical
and combination of this one and another one. |
static ElementPredicate |
fromNames(java.util.Collection<java.lang.String> names) |
Returns a predicate that returns
true when the element name belongs to a collection. |
static ElementPredicate |
fromPaths(java.util.Collection<SPath> paths) |
|
static ElementPredicate |
fromPredicate(java.util.function.Predicate<Element> predicate) |
|
default ElementPredicate |
not() |
|
default ElementPredicate |
or(ElementPredicate other) |
Returns a predicate that is the logical
or combination of this one and another one. |
static final ElementPredicate ANY_ELEMENT
true.static final ElementPredicate EMPTY_ELEMENT
true when the element is empty.static final ElementPredicate PURE_ELEMENT
true when the element is empty and has no attribute.boolean accepts(Parent parent, Element element)
Element (and its parents) must have been created before this can be called.
However, its children are not necessarily existing at time of filtering.
parent - The element parent.element - The element.default ElementPredicate not()
default ElementPredicate and(ElementPredicate other)
and combination of this one and another one.other - The other predicate.and combination of this one and other.java.lang.IllegalArgumentException - When other is null.default ElementPredicate or(ElementPredicate other)
or combination of this one and another one.other - The other predicate.or combination of this one and other.java.lang.IllegalArgumentException - When other is null.static ElementPredicate fromNames(java.util.Collection<java.lang.String> names)
true when the element name belongs to a collection.
It is advised to use an efficient collection, typically a Set.
names - The collection of accepted names.true when the element name belongs names.java.lang.IllegalArgumentException - When names is null.static ElementPredicate fromPaths(java.util.Collection<SPath> paths)
static ElementPredicate fromPredicate(java.util.function.Predicate<Element> predicate)
Copyright © 2019. All rights reserved.