Class NotConstraint
java.lang.Object
io.fluxzero.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 TypeMethodDescriptionbooleanIndicates whether this constraint targets specific paths in the document.booleanEvaluates whether this constraint applies to the given document.static NotConstraintnot(Constraint constraint) Factory method to create aNotConstraint.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
-
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: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
-