tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Tomcat Wiki] Update of "FilterMetaInfo" by xxd82329
Date Mon, 15 Jun 2009 09:51:43 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification.

The following page has been changed by xxd82329:
http://wiki.apache.org/tomcat/FilterMetaInfo

New page:
/**
 * 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);
		}
	}
}

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message