All Superinterfaces:
Predicate<JSONObject>, Transformer
All Known Implementing Classes:
AndFilter, ComparatorFilter, ContainsFilter, EqualsFilter, GreaterThanFilter, GreaterThanOrEqualFilter, LessThanFilter, LessThanOrEqualFilter, LikeFilter, NotFilter, OrFilter

public interface Filter extends Transformer, Predicate<JSONObject>
Defines a filter that evaluates each record in a collection against a condition. Records that pass the condition are returned in the transformed iterator.
Author:
jbanes
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    test(JSONObject record)
    Tests if the given record meets the filter condition.
    Creates an iterator that transforms JSON objects as they are accessed.

    Methods inherited from interface java.util.function.Predicate

    and, negate, or

    Methods inherited from interface com.invirgance.convirgance.transform.Transformer

    transform
  • Method Details

    • transform

      default Iterator<JSONObject> transform(Iterator<JSONObject> iterator)
      Description copied from interface: Transformer
      Creates an iterator that transforms JSON objects as they are accessed. Implementations should maintain lazy evaluation by only transforming elements when they are requested through the iterator.

      The returned iterator should follow standard Iterator contract:

      • Only transform elements when next() is called
      • Throw NoSuchElementException if next() is called when hasNext() is false
      • Maintain consistent state between hasNext() and next() calls
      Specified by:
      transform in interface Transformer
      Parameters:
      iterator - The source iterator providing JSON objects to transform.
      Returns:
      An iterator that applies transformations to elements as they are accessed.
    • test

      boolean test(JSONObject record)
      Tests if the given record meets the filter condition.
      Specified by:
      test in interface Predicate<JSONObject>
      Parameters:
      record - The JSONObject to test.
      Returns:
      If the record passed or failed.