class RegexFilterOperation implements FilterOperation {

  @Override
  public boolean test(InternalEvent ievent) {
    DeserializedEvent devent = ievent.getEventObj();
    if (devent == null) {
      return false;
    }

    boolean found;
    try {
      String field = devent.getFieldAsString(this.path);
      found = this.pattern.matcher(field).matches();
    } catch (FieldNotFoundException e) {
      found = false;
    }

    /*
     * When false is returned then the event is excluded from the stream.
     */
    return this.exclude != found;
  }

  public  RegexFilterOperation(Pattern pattern, String path, Boolean exclude);

}