Class NotConstraint
java.lang.Object
io.fluxcapacitor.common.api.search.constraints.NotConstraint
- All Implemented Interfaces:
Constraint
A constraint that negates the result of another constraint.
This is equivalent to a logical NOT. A document matches this constraint if it does not match the provided inner constraint.
Example: to find all documents that do not have a particular value:
Constraint notAdmin = NotConstraint.not(MatchConstraint.match("admin", "userRole"));
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Indicates whether this constraint targets specific paths in the document.boolean
Evaluates whether this constraint applies to the given document.static NotConstraint
not
(Constraint constraint) Factory method to create aNotConstraint
.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
-
NotConstraint
public NotConstraint()
-
-
Method Details
-
not
Factory method to create aNotConstraint
.- Parameters:
constraint
- the constraint to negate- Returns:
- a constraint that matches if the input constraint does not 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
-