ca.uhn.fhir.rest.annotation.IncludeParam 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.annotation;
import ca.uhn.fhir.model.api.Include;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Method parameter which is used to indicate a parameter that will
* be populated with the "_include" (or "_revinclude") values for a search param.
* The parameter annotated with this annotation is used for either "_include"
* or "_revinclude", depending on whether {@link #reverse()} has been
* set to true
(default is false
).
*
*
* Only up to two parameters may be annotated with this annotation (one each
* for reverse=false
and reverse=true
. That
* parameter should be one of the following:
*
*
* Collection<Include>
* List<Include>
* Set<Include>
*
*
* @see Include
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(value = {ElementType.PARAMETER})
public @interface IncludeParam {
/**
* Optional value, if provided the server will only allow the values
* within the given set. If an _include parameter is passed to the server
* which does not match any allowed values the server will return an error.
*
* Values for this parameter take the form that the FHIR specification
* defines for _include
values, namely [Resource Name].[path]
.
* For example: "Patient.link.other"
* or "Encounter.partOf"
*
*
* You may also pass in a value of "*" which indicates means that the
* client may request _include=*
. This is a request to
* include all referenced resources as well as any resources referenced
* by those resources, etc.
*
*
* Leave this parameter empty if you do not want the server to declare or
* restrict which includes are allowable. In this case, the client may add
* any _include value they want, and that value will be accepted by the server
* and passed to the handling method. Note that this means that the server
* will not declare which _include values it supports in its conformance
* statement.
*
*/
String[] allow() default {};
/**
* If set to true
(default is false
), the values
* for this parameter correspond to the _revinclude parameter
* instead of the _include parameter.
*/
boolean reverse() default false;
}