Class NoOpConstraint

java.lang.Object
io.fluxcapacitor.common.api.search.NoOpConstraint
All Implemented Interfaces:
Constraint

public class NoOpConstraint extends Object implements Constraint
A Constraint implementation that matches all documents and imposes no filtering conditions.

This is typically used as a placeholder or default when no real constraint is needed. It always returns true for matches(Document) and is considered to have no path constraints.

This constraint is used internally by various factory methods (such as those in MatchConstraint, FacetConstraint, etc.) when an input is null, empty, or otherwise does not yield a meaningful constraint.

For example, MatchConstraint.match(null) returns a NoOpConstraint.

  • Field Details

    • instance

      public static final NoOpConstraint instance
      Singleton instance of the no-op constraint.
  • Constructor Details

    • NoOpConstraint

      public NoOpConstraint()
  • Method Details

    • matches

      public boolean matches(Document document)
      Always returns true, indicating that any document matches.
      Specified by:
      matches in interface Constraint
      Parameters:
      document - the document to test
      Returns:
      true if the constraint matches the document
    • hasPathConstraint

      public boolean hasPathConstraint()
      Always returns false, as this constraint is not tied to any document path.
      Specified by:
      hasPathConstraint in interface Constraint
      Returns:
      true if path-based filtering is involved