Interface Filter
- All Superinterfaces:
Predicate<JSONObject>,Transformer
- All Known Implementing Classes:
AndFilter,ComparatorFilter,ContainsFilter,EqualsFilter,GreaterThanFilter,GreaterThanOrEqualFilter,LessThanFilter,LessThanOrEqualFilter,LikeFilter,NotFilter,OrFilter
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 TypeMethodDescriptionbooleantest(JSONObject record) Tests if the given record meets the filter condition.default Iterator<JSONObject> transform(Iterator<JSONObject> iterator) Creates an iterator that transforms JSON objects as they are accessed.Methods inherited from interface com.invirgance.convirgance.transform.Transformer
transform
-
Method Details
-
transform
Description copied from interface:TransformerCreates 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:
transformin interfaceTransformer- Parameters:
iterator- The source iterator providing JSON objects to transform.- Returns:
- An iterator that applies transformations to elements as they are accessed.
-
test
Tests if the given record meets the filter condition.- Specified by:
testin interfacePredicate<JSONObject>- Parameters:
record- The JSONObject to test.- Returns:
- If the record passed or failed.
-