1 /** 2 * Copyright 2005-2012 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krad.datadictionary.validation.constraint.provider; 17 18 import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable; 19 import org.kuali.rice.krad.datadictionary.validation.constraint.Constraint; 20 21 import java.util.List; 22 23 /** 24 * An object that determines a list of constraints for a given Constrainable definition for an attribute 25 * in the data dictionary. The ConstraintProvider interface must be implemented by any class that contributes 26 * Constraints to the DictionaryValidationService. Multiple ConstraintProviders can be registered simultaneously, 27 * and each can contribute constraints for any number of constraint types. 28 * 29 * These constraints can be looked up in a variety of ways. They may be: 30 * 31 * (1) member variables of the Constrainable definition itself {@see CaseConstrainable.class} 32 * (2) the Constrainable definition itself may extend Constraint {@see LengthConstrainable.class} 33 * (3) provided from some external source, or generated on the fly 34 * 35 * The goal here is to provide a mechanism that enables implementing institutions to inject new Constraints and ConstraintProcessor 36 * classes into the DictionaryValidationService implementation via dependency injection. 37 * 38 * @author Kuali Rice Team (rice.collab@kuali.org) 39 * @since 1.1 40 */ 41 public interface ConstraintProvider<T extends Constrainable> { 42 43 public List<Constraint> getConstraints(T definition, Class<? extends Constraint> constraintType); 44 45 public boolean isSupported(Constrainable definition); 46 47 }