ca.uhn.fhir.rest.param.ParamPrefixEnum Maven / Gradle / Ivy
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.rest.param;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* Comparator/qualifier for values used in REST params, such as {@link DateParam}, {@link NumberParam}, and
* {@link QuantityParam}
*
* @since 1.5
*/
public enum ParamPrefixEnum {
/**
* Code Value: eq
*
* The actual value is equal to the given value
*/
APPROXIMATE("ap"),
/**
* Code Value: eb
*
* The range of the search value does overlap not with the range of the target value, and the range above the search value contains the range of the target value
*/
ENDS_BEFORE("eb"),
/**
* Code Value: eq
*
* The actual value is equal to the given value
*/
EQUAL("eq"),
/**
* Code Value: gt
*
* The actual value is greater than the given value.
*/
GREATERTHAN("gt"),
/**
* Code Value: ge
*
* The actual value is greater than or equal to the given value.
*/
GREATERTHAN_OR_EQUALS("ge"),
/**
* Code Value: lt
*
* The actual value is less than the given value.
*/
LESSTHAN("lt"),
/**
* Code Value: le
*
* The actual value is less than or equal to the given value.
*/
LESSTHAN_OR_EQUALS("le"),
/**
* Code Value: ne
*
* The actual value is not equal to the given value
*/
NOT_EQUAL("ne"),
/**
* Code Value: sa
*
* The range of the search value does not overlap with the range of the target value, and the range below the search value contains the range of the target value
*/
STARTS_AFTER("sa");
private static final Map VALUE_TO_PREFIX;
static {
HashMap valueToPrefix = new HashMap();
for (ParamPrefixEnum next : values()) {
valueToPrefix.put(next.getValue(), next);
}
VALUE_TO_PREFIX = Collections.unmodifiableMap(valueToPrefix);
}
private final String myValue;
private ParamPrefixEnum(String theValue) {
myValue = theValue;
}
/**
* Returns the value, e.g. lt
or eq
*/
public String getValue() {
return myValue;
}
/**
* Returns the prefix associated with a given DSTU2+ value (e.g. lt
or eq
)
*
* @param theValue
* e.g. <
or ~
* @return The prefix, or null
if no prefix matches the value
*/
public static ParamPrefixEnum forValue(String theValue) {
return VALUE_TO_PREFIX.get(theValue);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy