1 /******************************************************************************* 2 * Copyright (c) 2005, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jface.internal.databinding.provisional.validation; 12 13 14 /** 15 * A validator. This validator is responsible for telling clients if its associated 16 * type conversion function will succeed or fail. For example, a String2IntValidator would 17 * only accept source Strings that can successfully be converted to an integer value. 18 * <p> 19 * <strong>EXPERIMENTAL</strong>. This class or interface has been added as 20 * part of a work in progress. There is no guarantee that this API will remain 21 * unchanged during the 3.2 release cycle. Please do not use this API without 22 * consulting with the Platform/UI team. 23 * </p> 24 * 25 * @since 1.0 26 * 27 */ 28 public interface IValidator { 29 30 /** 31 * Determines if the given value is partially valid. This method is used to 32 * determine, for example, if keystrokes can still be applied to the value. 33 * 34 * @param value 35 * the value to validate 36 * @return the ValidationError, or </code>null</code> if the value is 37 * partially valid. 38 */ 39 public ValidationError isPartiallyValid(Object value); 40 41 /** 42 * Determines if the given value is valid, that is if it can successfully 43 * be converted to the target data type. 44 * 45 * @param value 46 * the value to validate 47 * @return the ValidationError, or </code>null</code> if the value is valid. 48 */ 49 public ValidationError isValid(Object value); 50 51 } 52