| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ParameterEvaluator |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright 2007-2009 The Kuali Foundation | |
| 3 | * | |
| 4 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
| 5 | * you may not use this file except in compliance with the License. | |
| 6 | * You may obtain a copy of the License at | |
| 7 | * | |
| 8 | * http://www.opensource.org/licenses/ecl2.php | |
| 9 | * | |
| 10 | * Unless required by applicable law or agreed to in writing, software | |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| 13 | * See the License for the specific language governing permissions and | |
| 14 | * limitations under the License. | |
| 15 | */ | |
| 16 | package org.kuali.rice.core.api.parameter; | |
| 17 | ||
| 18 | import java.io.Serializable; | |
| 19 | ||
| 20 | /** | |
| 21 | * This is a stateful wrapper for Parameters, which provides convenient methods to evaluate a constrained value against a Parameter. | |
| 22 | */ | |
| 23 | public interface ParameterEvaluator extends Serializable { | |
| 24 | /** | |
| 25 | * This method determines whether the constrainedValue specified when the ParameterEvaluator was created matches the parameter. | |
| 26 | * | |
| 27 | * @return boolean indicating whether the constrained value adheres to the restriction specified by the combination of the | |
| 28 | * parameter constraint and the parameter value | |
| 29 | */ | |
| 30 | public boolean evaluationSucceeds(); | |
| 31 | ||
| 32 | /** | |
| 33 | * This method uses the evaluateAndAddError method. It passes the constrainedPropertyName as both the constrainedPropertyName | |
| 34 | * and the userEditablePropertyName, i.e. it should be used when they are one and the same. | |
| 35 | * | |
| 36 | * @param businessObjectOrDocumentClass | |
| 37 | * @param constrainedPropertyName | |
| 38 | * @return boolean indicating whether evaluation succeeded (see evaluationSucceeds) | |
| 39 | */ | |
| 40 | public boolean evaluateAndAddError(Class<? extends Object> businessObjectOrDocumentClass, String constrainedPropertyName); | |
| 41 | ||
| 42 | /** | |
| 43 | * This method uses the evaluationSucceeds method to evaluate the constrainedValue. If evaluation does not succeed, it adds an | |
| 44 | * error for the user. The businessObjectOrDocumentClass, nameOfConstrainedProperty and userEditablePropertyName are used by | |
| 45 | * ParameterEvaluatorImpl to retrieve user friendly labels for the error message. The constrainedPropertyName corresponds to the | |
| 46 | * field that has the value that the parameter is evaluating. The userEditablePropertyName corresponds to the field that has the | |
| 47 | * value the user needs to correct to resolve the error. For example, the object type may be invalid, but the user needs to | |
| 48 | * change the object code in order to remedy that. | |
| 49 | * | |
| 50 | * @param businessObjectOrDocumentClass | |
| 51 | * @param userEditableFieldToHighlight | |
| 52 | * @param nameOfconstrainedProperty | |
| 53 | * @return boolean indicating whether evaluation succeeded (see evaluationSucceeds) | |
| 54 | */ | |
| 55 | public boolean evaluateAndAddError(Class<? extends Object> businessObjectOrDocumentClass, String constrainedPropertyName, String userEditablePropertyName); | |
| 56 | ||
| 57 | /** | |
| 58 | * This method determines whether the parameter lists allowed values or denied values. | |
| 59 | * | |
| 60 | * @return boolean indicating whether the parameter lists allowed values | |
| 61 | */ | |
| 62 | public boolean constraintIsAllow(); | |
| 63 | ||
| 64 | /** | |
| 65 | * This method creates a pretty String representation of parameter values for the user messages. | |
| 66 | * | |
| 67 | * @return user-friendly String representation of Parameter values | |
| 68 | */ | |
| 69 | public String getParameterValuesForMessage(); | |
| 70 | ||
| 71 | /** | |
| 72 | * This method returns the value of the correspnding Parameter. | |
| 73 | * | |
| 74 | * @return String value of underlying Parameter | |
| 75 | */ | |
| 76 | public String getValue(); | |
| 77 | } |