Coverage Report - org.kuali.rice.core.api.parameter.EvaluationOperator
 
Classes in this File Line Coverage Branch Coverage Complexity
EvaluationOperator
53%
7/13
0%
0/6
3
 
 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  
  * Defines the possible evaluation operators that can be supported on system parameters.
 9  
  */
 10  2
 @XmlType(name = "EvaluationOperatorType")
 11  
 @XmlEnum(String.class)
 12  
 public enum EvaluationOperator {
 13  
 
 14  
         /**
 15  
          * Indicates that evaluation will determine if the value being tested in present
 16  
          * in the set of values defined on the parameter.  If it is present in this set,
 17  
          * then evaluation will succeed.
 18  
          */
 19  1
         @XmlEnumValue(value="A") ALLOW("A"),
 20  
         
 21  
         /**
 22  
          * Indicates that evaluation will determine if the value being tested is absent
 23  
          * from the set of values defined on the parameter.  If it is absent from this
 24  
          * set, then the evaluation will succeed.
 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  
          * Returns the operator code for this evaluation operator.
 36  
          * 
 37  
          * @return the operatorCode
 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  
 }