001package ca.uhn.fhir.rest.param;
002
003/*
004 * #%L
005 * HAPI FHIR - Core Library
006 * %%
007 * Copyright (C) 2014 - 2022 Smile CDR, Inc.
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 *
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023import java.util.Collections;
024import java.util.HashMap;
025import java.util.Map;
026
027/**
028 * Qualifiers for {@link UriParam}
029 */
030public enum UriParamQualifierEnum {
031
032        /**
033         * The search parameter is a concept with the form <code>[system]|[code]</code>, 
034         * and the search parameter tests whether the coding in a resource subsumes the 
035         * specified search code. For example, the search concept has an is-a relationship 
036         * with the coding in the resource, and this includes the coding itself.
037         * <p>
038         * Value <code>:above</code>
039         * </p> 
040         */
041        ABOVE(":above"),
042        
043        /**
044         * The search parameter is a concept with the form <code>[system]|[code]</code>, 
045         * and the search parameter tests whether the coding in a resource subsumes the 
046         * specified search code. For example, the search concept has an is-a relationship 
047         * with the coding in the resource, and this includes the coding itself.
048         * <p>
049         * Value <code>:below</code>
050         * </p> 
051         */
052        BELOW(":below");
053        
054        private static final Map<String, UriParamQualifierEnum> KEY_TO_VALUE;
055
056        static {
057                HashMap<String, UriParamQualifierEnum> key2value = new HashMap<String, UriParamQualifierEnum>();
058                for (UriParamQualifierEnum next : values()) {
059                        key2value.put(next.getValue(), next);
060                }
061                KEY_TO_VALUE = Collections.unmodifiableMap(key2value);
062        }
063
064        private final String myValue;
065        private UriParamQualifierEnum(String theValue) {
066                myValue = theValue;
067        }
068        
069        /**
070         * Returns the qualifier value, e.g. <code>:below</code>
071         */
072        public String getValue() {
073                return myValue;
074        }
075        
076        /**
077         * Returns the {@link UriParamQualifierEnum} matching the given qualifier value, such as <code>:below</code>,
078         * or <code>null</code>
079         */
080        public static UriParamQualifierEnum forValue(String theValue) {
081                return KEY_TO_VALUE.get(theValue);
082        }
083        
084}