| 1 | |
package org.kuali.rice.core.api.parameter; |
| 2 | |
|
| 3 | |
import javax.xml.bind.annotation.XmlEnum; |
| 4 | |
import javax.xml.bind.annotation.XmlEnumValue; |
| 5 | |
import javax.xml.bind.annotation.XmlType; |
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | 2 | @XmlType(name = "EvaluationOperatorType") |
| 11 | |
@XmlEnum(String.class) |
| 12 | |
public enum EvaluationOperator { |
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | 1 | @XmlEnumValue(value="A") ALLOW("A"), |
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | 1 | @XmlEnumValue(value="D") DISALLOW("D"); |
| 27 | |
|
| 28 | |
private final String operatorCode; |
| 29 | |
|
| 30 | 2 | EvaluationOperator(final String operatorCode) { |
| 31 | 2 | this.operatorCode = operatorCode; |
| 32 | 2 | } |
| 33 | |
|
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
public String getOperatorCode() { |
| 40 | 1 | return operatorCode; |
| 41 | |
} |
| 42 | |
|
| 43 | |
public static EvaluationOperator fromOperatorCode(String operatorCode) { |
| 44 | 0 | if (operatorCode == null) { |
| 45 | 0 | return null; |
| 46 | |
} |
| 47 | 0 | for (EvaluationOperator operator : values()) { |
| 48 | 0 | if (operator.operatorCode.equals(operatorCode)) { |
| 49 | 0 | return operator; |
| 50 | |
} |
| 51 | |
} |
| 52 | 0 | throw new IllegalArgumentException("Failed to locate the EvaluationOperator with the given code: " + operatorCode); |
| 53 | |
} |
| 54 | |
|
| 55 | |
} |