001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.datadictionary.validation.constraint.provider;
017
018import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable;
019import org.kuali.rice.krad.datadictionary.validation.constraint.Constraint;
020
021import java.util.List;
022
023/**
024 * An object that determines a list of constraints for a given Constrainable definition for an attribute 
025 * in the data dictionary. The ConstraintProvider interface must be implemented by any class that contributes
026 * Constraints to the DictionaryValidationService. Multiple ConstraintProviders can be registered simultaneously,
027 * and each can contribute constraints for any number of constraint types. 
028 * 
029 * These constraints can be looked up in a variety of ways. They may be:
030 * 
031 * (1) member variables of the Constrainable definition itself {@see CaseConstrainable.class}
032 * (2) the Constrainable definition itself may extend Constraint {@see LengthConstrainable.class}
033 * (3) provided from some external source, or generated on the fly
034 * 
035 * The goal here is to provide a mechanism that enables implementing institutions to inject new Constraints and ConstraintProcessor
036 * classes into the DictionaryValidationService implementation via dependency injection. 
037 * 
038 * @author Kuali Rice Team (rice.collab@kuali.org)
039 * @since 1.1
040 */
041public interface ConstraintProvider<T extends Constrainable> {
042
043        public List<Constraint> getConstraints(T definition, Class<? extends Constraint> constraintType);
044        
045        public boolean isSupported(Constrainable definition);
046        
047}