001
002package ca.uhn.fhir.model.dstu2.valueset;
003
004import ca.uhn.fhir.model.api.*;
005import java.util.HashMap;
006import java.util.Map;
007
008public enum ContractActionCodesEnum {
009
010        /**
011         * Code Value: <b>action-a</b>
012         */
013        ACTION_A("action-a", "http://www.hl7.org/fhir/contractaction"),
014        
015        /**
016         * Code Value: <b>action-b</b>
017         */
018        ACTION_B("action-b", "http://www.hl7.org/fhir/contractaction"),
019        
020        ;
021        
022        /**
023         * Identifier for this Value Set:
024         * 
025         */
026        public static final String VALUESET_IDENTIFIER = "";
027
028        /**
029         * Name for this Value Set:
030         * Contract Action Codes
031         */
032        public static final String VALUESET_NAME = "Contract Action Codes";
033
034        private static Map<String, ContractActionCodesEnum> CODE_TO_ENUM = new HashMap<String, ContractActionCodesEnum>();
035        private static Map<String, Map<String, ContractActionCodesEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, ContractActionCodesEnum>>();
036        
037        private final String myCode;
038        private final String mySystem;
039        
040        static {
041                for (ContractActionCodesEnum next : ContractActionCodesEnum.values()) {
042                        CODE_TO_ENUM.put(next.getCode(), next);
043                        
044                        if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
045                                SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, ContractActionCodesEnum>());
046                        }
047                        SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);                 
048                }
049        }
050        
051        /**
052         * Returns the code associated with this enumerated value
053         */
054        public String getCode() {
055                return myCode;
056        }
057        
058        /**
059         * Returns the code system associated with this enumerated value
060         */
061        public String getSystem() {
062                return mySystem;
063        }
064        
065        /**
066         * Returns the enumerated value associated with this code
067         */
068        public static ContractActionCodesEnum forCode(String theCode) {
069                ContractActionCodesEnum retVal = CODE_TO_ENUM.get(theCode);
070                return retVal;
071        }
072
073        /**
074         * Converts codes to their respective enumerated values
075         */
076        public static final IValueSetEnumBinder<ContractActionCodesEnum> VALUESET_BINDER = new IValueSetEnumBinder<ContractActionCodesEnum>() {
077                @Override
078                public String toCodeString(ContractActionCodesEnum theEnum) {
079                        return theEnum.getCode();
080                }
081
082                @Override
083                public String toSystemString(ContractActionCodesEnum theEnum) {
084                        return theEnum.getSystem();
085                }
086                
087                @Override
088                public ContractActionCodesEnum fromCodeString(String theCodeString) {
089                        return CODE_TO_ENUM.get(theCodeString);
090                }
091                
092                @Override
093                public ContractActionCodesEnum fromCodeString(String theCodeString, String theSystemString) {
094                        Map<String, ContractActionCodesEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
095                        if (map == null) {
096                                return null;
097                        }
098                        return map.get(theCodeString);
099                }
100                
101        };
102        
103        /** 
104         * Constructor
105         */
106        ContractActionCodesEnum(String theCode, String theSystem) {
107                myCode = theCode;
108                mySystem = theSystem;
109        }
110
111        
112}