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
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
25
26 public class SimpleConstraintResolver<T extends Constrainable> implements ConstraintResolver<T> {
27
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 } else {
40 return new ArrayList<C>();
41 }
42 }
43 }