All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.xson.web.xml.InterceptVo Maven / Gradle / Ivy

Go to download

xco-web is an easy to use control layer framework, is part of the SOA system, using xml language to describe the controller.

The newest version!
package org.xson.web.xml;

import java.util.List;

import org.xson.web.util.PatternMatchUtils;

/**
 * 前置、后置、数据组装处理器VO
 */
public class InterceptVo implements Comparable {

	/**
	 * 拦截节点类型
	 */
	public enum InterceptType {
		ASSEMBLY, BEFORE, AFTER
	}

	private MethodObject	mo;
	private int				order;
	private List	includeList;
	private List	excludeList;

	public InterceptVo(MethodObject mo, int order, List includeList, List excludeList) {
		this.mo = mo;
		this.order = order;
		this.includeList = includeList;
		this.excludeList = excludeList;
	}

	public InterceptVo(MethodObject mo, int order) {
		this.mo = mo;
		this.order = order;
	}

	public boolean match(String url) {
		if (null != excludeList) {
			for (String pattern : excludeList) {
				if (PatternMatchUtils.simpleMatch(pattern, url)) {
					return false;
				}
			}
		}
		if (null != includeList) {
			for (String pattern : includeList) {
				if (!PatternMatchUtils.simpleMatch(pattern, url)) {
					return false;
				}
			}
		}
		return true;
	}

	public MethodObject getMo() {
		return mo;
	}

	@Override
	public int compareTo(InterceptVo o) {
		if (this.order > o.order) {
			return 1;
		} else if (this.order < o.order) {
			return -1;
		}
		return 0;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy