Class AllConstraint
java.lang.Object
io.fluxcapacitor.common.api.search.constraints.AllConstraint
- All Implemented Interfaces:
Constraint
A composite constraint that requires all inner constraints to match.
This is equivalent to a logical AND operation over the contained constraints. The document must
satisfy every inner constraint in the list for the AllConstraint
to match.
If the constraint list is empty, this becomes a no-op constraint that matches all documents. If only one constraint is provided, it is returned directly to avoid unnecessary nesting.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Constraint
all
(Constraint... constraints) Creates anAllConstraint
from the given array of constraints.static Constraint
all
(Collection<Constraint> constraints) Creates anAllConstraint
from the given collection of constraints.boolean
Indicates whether this constraint targets specific paths in the document.boolean
Evaluates whether this constraint applies to the given document.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.api.search.Constraint
and, decompose, or
-
Constructor Details
-
AllConstraint
public AllConstraint()
-
-
Method Details
-
all
Creates anAllConstraint
from the given array of constraints.If the array is empty, a
NoOpConstraint
is returned. If only one constraint is provided, that constraint is returned directly.- Parameters:
constraints
- one or more constraints to combine- Returns:
- a constraint that requires all inputs to match
-
all
Creates anAllConstraint
from the given collection of constraints.If the collection is empty, a
NoOpConstraint
is returned. If it contains only one constraint, that constraint is returned directly.- Parameters:
constraints
- a collection of constraints to combine- Returns:
- a constraint that requires all inputs to match
-
matches
Description copied from interface:Constraint
Evaluates whether this constraint applies to the given document.- Specified by:
matches
in interfaceConstraint
- Parameters:
document
- the document to test- Returns:
true
if the constraint matches the document
-
hasPathConstraint
public boolean hasPathConstraint()Description copied from interface:Constraint
Indicates whether this constraint targets specific paths in the document.- Specified by:
hasPathConstraint
in interfaceConstraint
- Returns:
true
if path-based filtering is involved
-