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

org.xson.common.validate.RuleGroup Maven / Gradle / Ivy

Go to download

xco-validate based XCO, using xml language to describe data validation framework.

The newest version!
package org.xson.common.validate;

import org.xson.common.object.XCO;

import java.util.List;

public class RuleGroup {

	private String				id;
	private List	items;
	private String				desc;		// 描述
	private String				message;	// 错误信息

	public RuleGroup(String id, List items, String desc, String message) {
		this.id = id;
		this.items = items;
		this.desc = desc;
		this.message = message;
	}

	public String getId() {
		return id;
	}

	protected List getItems() {
		return this.items;
	}

	public String getDesc() {
		return desc;
	}

	public String getMessage() {
		return message;
	}

	public boolean check(XCO xco) {

		boolean result = false;

		for (RuleGroupItem item : this.items) {
			result = item.check(xco);
			if (!result) {
				break;
			}
		}

		if (!result && Container.onValidateFailedThrowException) {
			throw new XCOValidateException(Container.errorCode, (null != this.message) ? this.message : Container.errorMessage);
		}

		return result;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy