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