001/**
002 * Copyright 2005-2018 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.resolver;
017
018import java.util.List;
019
020import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable;
021import org.kuali.rice.krad.datadictionary.validation.constraint.Constraint;
022import org.kuali.rice.krad.datadictionary.validation.constraint.provider.AttributeDefinitionConstraintProvider;
023
024/**
025 * ConstraintResolver provides a lookup of constraints for a specific constrainable attribute definition
026 *
027 * <p>Implemented by constraint
028 * providers as a mechanism to store functional lookups in a map, keyed by constraint type, for example.</p>
029 *
030 * {@link AttributeDefinitionConstraintProvider} for a number of examples.
031 *
032 * @param <T> constrainable type
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 * @since 1.1
035 */
036public interface ConstraintResolver<T extends Constrainable> {
037
038    /**
039     * gets the list of constraints from the provided definition
040     *
041     * @param definition - a data dictionary definition
042     * @param <C> - the java type of the constraint
043     * @return - a list of constraints
044     */
045    public <C extends Constraint> List<C> resolve(T definition);
046
047}