Differences between revisions 1 and 2
Revision 1 as of 2009-06-15 09:51:40
Size: 1391
Editor: xxd82329
Comment:
Revision 2 as of 2009-09-20 23:57:18
Size: 1391
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

/**

  • 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);
      }
    }

}

FilterMetaInfo (last edited 2009-09-20 23:57:18 by localhost)