/* ===================================================================
 * PagedValidator.java
 * 
 * Created Sep 16, 2004 9:22:44 AM
 * 
 * Copyright (c) 2004 Matt Magoffin (spamsqr@msqr.us)
 * 
 * This program is free software; you can redistribute it and/or 
 * modify it under the terms of the GNU General Public License as 
 * published by the Free Software Foundation; either version 2 of 
 * the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License 
 * along with this program; if not, write to the Free Software 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 
 * 02111-1307 USA
 * ===================================================================
 * $Id: PagedValidator.java 27 2009-05-03 23:40:50Z msqr $
 * ===================================================================
 */

package magoffin.matt.ieat.validation;

import org.springframework.validation.Errors;
import org.springframework.validation.Validator;

/**
 * Validation interface for page-based validation workflows.
 * 
 * @author Matt Magoffin (spamsqr@msqr.us)
 * @version $Revision: 27 $ $Date: 2009-05-04 11:40:50 +1200 (Mon, 04 May 2009) $
 */
public interface PagedValidator extends Validator {
	
	/** Page constant to signal that all pages should be validated. */
	public static final int VALIDATE_ALL_PAGES = -1;

	/**
	 * Validate an object for a specific "page" in a multi-page validation
	 * workflow, where the object must be of a class for which
	 * the supports() method returned true.
	 * @param obj  Populated object to validate
	 * @param errors  Errors object we're building. May contain
	 * errors for this field relating to types.
	 * @param page Page to validate. Pages should be 0-based, and if anything 
	 * less than 0 then validation for all pages should be performed.
	 */
	void validate(Object obj, Errors errors, int page);

}
