Coverage Report - org.kuali.rice.krms.api.repository.proposition.PropositionParameterType
 
Classes in this File Line Coverage Branch Coverage Complexity
PropositionParameterType
68%
13/19
0%
0/6
3
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.krms.api.repository.proposition;
 17  
 
 18  
 import org.kuali.rice.core.api.mo.common.Coded;
 19  
 
 20  
 import java.util.HashSet;
 21  
 import java.util.Set;
 22  
 
 23  
 /**
 24  
  * TODO... 
 25  
  * 
 26  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 27  
  *
 28  
  */
 29  2
 public enum PropositionParameterType implements Coded {
 30  
 
 31  1
         CONSTANT("C"),
 32  1
         TERM("T"),
 33  1
         FUNCTION("F"),
 34  1
         OPERATOR("O");
 35  
         
 36  
         private final String code;
 37  
         
 38  4
         private PropositionParameterType(String code) {
 39  4
                 this.code = code;
 40  4
         }
 41  
         
 42  
         public String getCode() {
 43  4
                 return code;
 44  
         }
 45  
         
 46  1
         public static final Set<String> VALID_TYPE_CODES = new HashSet<String>();
 47  
         static {
 48  5
                 for (PropositionParameterType propositionParameterType : values()) {
 49  4
                         VALID_TYPE_CODES.add(propositionParameterType.getCode());
 50  
                 }
 51  1
         }
 52  
         
 53  
         public static PropositionParameterType fromCode(String code) {
 54  0
                 if (code == null) {
 55  0
                         return null;
 56  
                 }
 57  0
                 for (PropositionParameterType propositionParameterType : values()) {
 58  0
                         if (propositionParameterType.code.equals(code)) {
 59  0
                                 return propositionParameterType;
 60  
                         }
 61  
                 }
 62  0
                 throw new IllegalArgumentException("Failed to locate the PropositionParameterType with the given code: " + code);
 63  
         }
 64  
         
 65  
 }