View Javadoc
1   package ca.uhn.fhir.rest.param;
2   
3   /*
4    * #%L
5    * HAPI FHIR - Core Library
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import java.util.Collections;
24  import java.util.HashMap;
25  import java.util.Map;
26  
27  /**
28   * Qualifiers for {@link UriParam}
29   */
30  public enum UriParamQualifierEnum {
31  
32  	/**
33  	 * The search parameter is a concept with the form <code>[system]|[code]</code>, 
34  	 * and the search parameter tests whether the coding in a resource subsumes the 
35  	 * specified search code. For example, the search concept has an is-a relationship 
36  	 * with the coding in the resource, and this includes the coding itself.
37  	 * <p>
38  	 * Value <code>:above</code>
39  	 * </p> 
40  	 */
41  	ABOVE(":above"),
42  	
43  	/**
44  	 * The search parameter is a concept with the form <code>[system]|[code]</code>, 
45  	 * and the search parameter tests whether the coding in a resource subsumes the 
46  	 * specified search code. For example, the search concept has an is-a relationship 
47  	 * with the coding in the resource, and this includes the coding itself.
48  	 * <p>
49  	 * Value <code>:below</code>
50  	 * </p> 
51  	 */
52  	BELOW(":below");
53  	
54  	private static final Map<String, UriParamQualifierEnum> KEY_TO_VALUE;
55  
56  	static {
57  		HashMap<String, UriParamQualifierEnum> key2value = new HashMap<String, UriParamQualifierEnum>();
58  		for (UriParamQualifierEnum next : values()) {
59  			key2value.put(next.getValue(), next);
60  		}
61  		KEY_TO_VALUE = Collections.unmodifiableMap(key2value);
62  	}
63  
64  	private final String myValue;
65  	private UriParamQualifierEnum(String theValue) {
66  		myValue = theValue;
67  	}
68  	
69  	/**
70  	 * Returns the qualifier value, e.g. <code>:below</code>
71  	 */
72  	public String getValue() {
73  		return myValue;
74  	}
75  	
76  	/**
77  	 * Returns the {@link UriParamQualifierEnum} matching the given qualifier value, such as <code>:below</code>,
78  	 * or <code>null</code>
79  	 */
80  	public static UriParamQualifierEnum forValue(String theValue) {
81  		return KEY_TO_VALUE.get(theValue);
82  	}
83  	
84  }