Coverage Report - org.kuali.rice.krms.api.repository.LogicalOperator
 
Classes in this File Line Coverage Branch Coverage Complexity
LogicalOperator
53%
8/15
0%
0/6
2.2
LogicalOperator$Adapter
0%
0/2
N/A
2.2
 
 1  
 package org.kuali.rice.krms.api.repository;
 2  
 
 3  
 import org.kuali.rice.core.api.mo.common.Coded;
 4  
 import org.kuali.rice.core.api.util.jaxb.EnumStringAdapter;
 5  
 
 6  
 import java.util.Arrays;
 7  
 import java.util.Collection;
 8  
 import java.util.Collections;
 9  
 
 10  1
 public enum LogicalOperator implements Coded {
 11  
         
 12  1
         AND("&"),
 13  1
         OR("|");
 14  
 
 15  
         private final String code;
 16  
         
 17  2
         private LogicalOperator(String code){
 18  2
                 this.code = code;
 19  2
         }
 20  
         
 21  
         @Override
 22  
         public String getCode(){
 23  3
                 return code;
 24  
         }
 25  
         
 26  1
         public static final Collection<String> OP_CODES =
 27  
                 Collections.unmodifiableCollection(Arrays.asList(AND.code, OR.code));
 28  
                 
 29  
         public static LogicalOperator fromCode(String code) {
 30  0
                 if (code == null) {
 31  0
                         return null;
 32  
                 }
 33  0
                 for (LogicalOperator logicalOperator : values()) {
 34  0
                         if (logicalOperator.code.equals(code)) {
 35  0
                                 return logicalOperator;
 36  
                         }
 37  
                 }
 38  0
                 throw new IllegalArgumentException("Failed to locate the LogicalOperator with the given code: " + code);
 39  
         }
 40  
         
 41  
         @Override
 42  
         public String toString(){
 43  0
                 return code;
 44  
         }
 45  
         
 46  0
         static final class Adapter extends EnumStringAdapter<LogicalOperator> {
 47  
                 
 48  
                 protected Class<LogicalOperator> getEnumClass() {
 49  0
                         return LogicalOperator.class;
 50  
                 }
 51  
                 
 52  
         }
 53  
 
 54  
 }