Page tree
Skip to end of metadata
Go to start of metadata

/**

  • some meta-info for filters, such as the configured level (engine/host, etc), and the
  • order it being configured in the config file.
  • @author xxd
  • */

public class FilterMetaInfo implements Comparable<FilterMetaInfo> {

// ---- Level for filters ----
public static enum FilterLevels {
ENGINE("engine"), HOST("host"), CONTEXT("context"), WRAPPER("wrapper");
private final String readableName;

private FilterLevels(String readableName) {
this.readableName = readableName;
}

/*

  • (non-Javadoc)
  • @see java.lang.Enum#toString() */
    @Override
    public String toString() { return this.readableName;
    }
    }
    private final FilterLevels level;
    private final int order;
    public FilterMetaInfo(FilterLevels level, int order) {
    super();
    this.level = level;
    this.order = order;
    }
    /**
  • @return the level
    */ public FilterLevels getLevel() {
    return level; }
    /**
    • @return the order */
      public int getOrder() { return order;
      }
      private int compareOrder(int order1, int order2) { return (order1 < order2 ? -1 : (order1 == order2 ? 0 : 1));
      }
      @Override
      public int compareTo(FilterMetaInfo o) { if (o.level != this.level) {
      return compareOrder(this.order, o.order); } else {
      return this.level.compareTo(o.level); }
      }

}

  • No labels