Class AnyConstraint
java.lang.Object
io.fluxzero.common.api.search.constraints.AnyConstraint
- All Implemented Interfaces:
Constraint
A composite constraint that requires at least one inner constraint to match.
This is equivalent to a logical OR operation over the contained constraints. The document matches if any of the provided constraints evaluate to true.
If the constraint list is empty, a NoOpConstraint is returned (which always matches). If only one constraint
is provided, it is returned directly without wrapping in an AnyConstraint.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Constraintany(Constraint... constraints) Creates anAnyConstraintfrom the given array of constraints.static Constraintany(Collection<Constraint> constraints) Creates anAnyConstraintfrom the given collection of constraints.booleanIndicates whether this constraint targets specific paths in the document.booleanEvaluates whether this constraint applies to the given document.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Constraint
and, decompose, or
-
Constructor Details
-
AnyConstraint
public AnyConstraint()
-
-
Method Details
-
any
Creates anAnyConstraintfrom the given array of constraints.If the array is empty, a
NoOpConstraintis returned. If only one constraint is provided, that constraint is returned directly.- Parameters:
constraints- one or more constraints to combine- Returns:
- a constraint that matches if any input matches
-
any
Creates anAnyConstraintfrom the given collection of constraints.If the collection is empty, a
NoOpConstraintis returned. If it contains only one constraint, that constraint is returned directly.- Parameters:
constraints- a collection of constraints to combine- Returns:
- a constraint that matches if any input matches
-
matches
Description copied from interface:ConstraintEvaluates whether this constraint applies to the given document.- Specified by:
matchesin interfaceConstraint- Parameters:
document- the document to test- Returns:
trueif the constraint matches the document
-
hasPathConstraint
public boolean hasPathConstraint()Description copied from interface:ConstraintIndicates whether this constraint targets specific paths in the document.- Specified by:
hasPathConstraintin interfaceConstraint- Returns:
trueif path-based filtering is involved
-