| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.kuali.rice.krms.api.repository.proposition; |
| 17 | |
|
| 18 | |
import java.util.HashSet; |
| 19 | |
import java.util.Set; |
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | 2 | public enum PropositionParameterType { |
| 28 | |
|
| 29 | 1 | CONSTANT("C"), |
| 30 | 1 | TERM("T"), |
| 31 | 1 | FUNCTION("F"), |
| 32 | 1 | OPERATOR("O"); |
| 33 | |
|
| 34 | |
private final String code; |
| 35 | |
|
| 36 | 4 | private PropositionParameterType(String code) { |
| 37 | 4 | this.code = code; |
| 38 | 4 | } |
| 39 | |
|
| 40 | |
public String getCode() { |
| 41 | 4 | return code; |
| 42 | |
} |
| 43 | |
|
| 44 | 1 | public static final Set<String> VALID_TYPE_CODES = new HashSet<String>(); |
| 45 | |
static { |
| 46 | 5 | for (PropositionParameterType propositionParameterType : values()) { |
| 47 | 4 | VALID_TYPE_CODES.add(propositionParameterType.getCode()); |
| 48 | |
} |
| 49 | 1 | } |
| 50 | |
|
| 51 | |
public static PropositionParameterType fromCode(String code) { |
| 52 | 0 | if (code == null) { |
| 53 | 0 | return null; |
| 54 | |
} |
| 55 | 0 | for (PropositionParameterType propositionParameterType : values()) { |
| 56 | 0 | if (propositionParameterType.code.equals(code)) { |
| 57 | 0 | return propositionParameterType; |
| 58 | |
} |
| 59 | |
} |
| 60 | 0 | throw new IllegalArgumentException("Failed to locate the PropositionParameterType with the given code: " + code); |
| 61 | |
} |
| 62 | |
|
| 63 | |
} |