Package org.jeasy.batch.core.filter
Class GrepFilter
- java.lang.Object
-
- org.jeasy.batch.core.filter.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 withStringRecord
type. Search is based onString.contains(CharSequence)
.- Author:
- Mahmoud Ben Hassine ([email protected])
-
-
Constructor Summary
Constructors Constructor Description GrepFilter(java.lang.String pattern)
Create a newGrepFilter
.
-
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.
-
-
-
Constructor Detail
-
GrepFilter
public GrepFilter(java.lang.String pattern)
Create a newGrepFilter
.- 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 interfaceRecordFilter<java.lang.String>
- Specified by:
processRecord
in interfaceRecordProcessor<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
-
-