In my interceptor class, the method intercept(Event event)
contains the logic as to how the data flows(as written in the question) which returns null in case the regex is not satisfied, and in the method intercept(List<Event> events)
the null events are excluded which servers the purpose. Following is the intercept(List<Event> events)
code:
public List<Event> intercept(List<Event> events)
{
List<Event> interceptedEvents = new ArrayList<Event>(events.size());
for (Event event : events)
{
// Intercept any event
Event interceptedEvent = intercept(event);
if(interceptedEvent!=null)
interceptedEvents.add(interceptedEvent);
}
return interceptedEvents;
}