Class GrepFilter

  • All Implemented Interfaces:
    RecordFilter<java.lang.String>, RecordProcessor<java.lang.String,​java.lang.String>

    public class GrepFilter
    extends java.lang.Object
    implements RecordFilter<java.lang.String>
    Convenient filter that mimics the unix grep utility: it keeps records containing the given pattern instead of filtering them. Should be used with StringRecord type. Search is based on String.contains(CharSequence).
    Author:
    Mahmoud Ben Hassine ([email protected])
    • Constructor Summary

      Constructors 
      Constructor Description
      GrepFilter​(java.lang.String pattern)
      Create a new GrepFilter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Record<java.lang.String> processRecord​(Record<java.lang.String> record)
      Filter a record.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GrepFilter

        public GrepFilter​(java.lang.String pattern)
        Create a new GrepFilter.
        Parameters:
        pattern - the pattern to look for
    • Method Detail

      • processRecord

        public Record<java.lang.String> processRecord​(Record<java.lang.String> record)
        Description copied from interface: RecordFilter
        Filter a record.
        Specified by:
        processRecord in interface RecordFilter<java.lang.String>
        Specified by:
        processRecord in interface RecordProcessor<java.lang.String,​java.lang.String>
        Parameters:
        record - the record to filter.
        Returns:
        the input record if it should continue in the pipeline or null if the record should be filtered