| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EvaluationOperator |
|
| 2.5;2.5 | ||||
| EvaluationOperator$Adapter |
|
| 2.5;2.5 |
| 1 | /** | |
| 2 | * Copyright 2005-2011 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 org.kuali.rice.core.api.mo.common.Coded; | |
| 19 | import org.kuali.rice.core.api.util.jaxb.EnumStringAdapter; | |
| 20 | ||
| 21 | /** | |
| 22 | * Defines the possible evaluation operators that can be supported on system parameters. | |
| 23 | */ | |
| 24 | 0 | public enum EvaluationOperator implements Coded { |
| 25 | ||
| 26 | /** | |
| 27 | * Indicates that evaluation will determine if the value being tested in present | |
| 28 | * in the set of values defined on the parameter. If it is present in this set, | |
| 29 | * then evaluation will succeed. | |
| 30 | */ | |
| 31 | 0 | ALLOW("A"), |
| 32 | ||
| 33 | /** | |
| 34 | * Indicates that evaluation will determine if the value being tested is absent | |
| 35 | * from the set of values defined on the parameter. If it is absent from this | |
| 36 | * set, then the evaluation will succeed. | |
| 37 | */ | |
| 38 | 0 | DISALLOW("D"); |
| 39 | ||
| 40 | private final String code; | |
| 41 | ||
| 42 | 0 | EvaluationOperator(final String code) { |
| 43 | 0 | this.code = code; |
| 44 | 0 | } |
| 45 | ||
| 46 | /** | |
| 47 | * Returns the operator code for this evaluation operator. | |
| 48 | * | |
| 49 | * @return the code | |
| 50 | */ | |
| 51 | @Override | |
| 52 | public String getCode() { | |
| 53 | 0 | return code; |
| 54 | } | |
| 55 | ||
| 56 | public static EvaluationOperator fromCode(String code) { | |
| 57 | 0 | if (code == null) { |
| 58 | 0 | return null; |
| 59 | } | |
| 60 | 0 | for (EvaluationOperator operator : values()) { |
| 61 | 0 | if (operator.code.equals(code)) { |
| 62 | 0 | return operator; |
| 63 | } | |
| 64 | } | |
| 65 | 0 | throw new IllegalArgumentException("Failed to locate the EvaluationOperator with the given code: " + code); |
| 66 | } | |
| 67 | ||
| 68 | 0 | static final class Adapter extends EnumStringAdapter<EvaluationOperator> { |
| 69 | ||
| 70 | protected Class<EvaluationOperator> getEnumClass() { | |
| 71 | 0 | return EvaluationOperator.class; |
| 72 | } | |
| 73 | ||
| 74 | } | |
| 75 | ||
| 76 | } |