1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.datadictionary.validation.constraint.resolver;
17
18 import org.kuali.rice.krad.datadictionary.validation.capability.Constrainable;
19 import org.kuali.rice.krad.datadictionary.validation.capability.SimpleConstrainable;
20 import org.kuali.rice.krad.datadictionary.validation.constraint.Constraint;
21 import org.kuali.rice.krad.uif.field.InputField;
22
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.List;
26
27 public class SimpleConstraintResolver<T extends Constrainable> implements ConstraintResolver<T> {
28
29
30
31
32
33
34
35 public <C extends Constraint> List<C> resolve(T definition) {
36 if(definition instanceof SimpleConstrainable){
37 C simpleConstraint = (C)(((SimpleConstrainable)definition).getSimpleConstraint());
38 return Collections.singletonList(simpleConstraint);
39 }
40 else{
41 return new ArrayList<C>();
42 }
43 }
44 }