Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
DataProviderInfc |
|
| 1.0;1 |
1 | /** | |
2 | * Copyright 2011 The Kuali Foundation Licensed under the | |
3 | * Educational Community License, Version 2.0 (the "License"); you may | |
4 | * not use this file except in compliance with the License. You may | |
5 | * obtain a copy of the License at | |
6 | * | |
7 | * http://www.osedu.org/licenses/ECL-2.0 | |
8 | * | |
9 | * Unless required by applicable law or agreed to in writing, | |
10 | * software distributed under the License is distributed on an "AS IS" | |
11 | * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
12 | * or implied. See the License for the specific language governing | |
13 | * permissions and limitations under the License. | |
14 | */ | |
15 | package org.kuali.student.kim.identity.mock; | |
16 | ||
17 | import java.util.List; | |
18 | import org.kuali.rice.kns.datadictionary.validation.DataType; | |
19 | ||
20 | /** | |
21 | * Provides values to compare | |
22 | * | |
23 | * @author nwright | |
24 | */ | |
25 | public interface DataProviderInfc<I, O> { | |
26 | ||
27 | /** | |
28 | * Gets the list of values to be compared | |
29 | * | |
30 | * @param obj data object | |
31 | * @param fieldKey path to field on data object | |
32 | * @return list of values for the specified field, if field occurs only once on object the list is of size one | |
33 | * @throws IllegalArgumentException if field key is invalid or not supported | |
34 | */ | |
35 | public List<Object> getValues(I obj, String fieldKey) | |
36 | throws IllegalArgumentException; | |
37 | ||
38 | /** | |
39 | * Get the data type of the field | |
40 | * | |
41 | * @param fieldKey | |
42 | * @return DataType of the field key, null if fieldKey is not valid or not supported | |
43 | * @throws IllegalArgumentException if field key is invalid or not supported | |
44 | */ | |
45 | public DataType getDataType(String fieldKey) | |
46 | throws IllegalArgumentException; | |
47 | ||
48 | /** | |
49 | * Checks if the field key is supported | |
50 | * @param fieldKey | |
51 | * @return true if it is supported, else false | |
52 | */ | |
53 | public boolean supportsField(String fieldKey); | |
54 | ||
55 | /** | |
56 | * Parses the supplied value to which the data field is to be compared | |
57 | * @param fieldKey | |
58 | * @param value | |
59 | * @return the value parsed to match the data type so it can be compaerd | |
60 | * @throws IllegalArgumentException if field key is invalid or not supported* | |
61 | */ | |
62 | public Object parseValue(String fieldKey, String value) | |
63 | throws IllegalArgumentException; | |
64 | } |