001package ca.uhn.fhir.rest.annotation; 002 003import java.lang.annotation.ElementType; 004 005/* 006 * #%L 007 * HAPI FHIR - Core Library 008 * %% 009 * Copyright (C) 2014 - 2021 Smile CDR, Inc. 010 * %% 011 * Licensed under the Apache License, Version 2.0 (the "License"); 012 * you may not use this file except in compliance with the License. 013 * You may obtain a copy of the License at 014 * 015 * http://www.apache.org/licenses/LICENSE-2.0 016 * 017 * Unless required by applicable law or agreed to in writing, software 018 * distributed under the License is distributed on an "AS IS" BASIS, 019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 020 * See the License for the specific language governing permissions and 021 * limitations under the License. 022 * #L% 023 */ 024 025import java.lang.annotation.Retention; 026import java.lang.annotation.RetentionPolicy; 027import java.lang.annotation.Target; 028 029import org.hl7.fhir.instance.model.api.IBaseResource; 030 031/** 032 * RESTful method annotation to be used for the proposed FHIR 033 * PATCH method 034 * 035 * <p> 036 * Patch is used to apply a differential to a resource in either 037 * XML or JSON format 038 * </p> 039 */ 040@Retention(RetentionPolicy.RUNTIME) 041@Target({ ElementType.METHOD }) 042public @interface Patch { 043 044 /** 045 * The return type for this search method. This generally does not need 046 * to be populated for a server implementation, since servers will return 047 * only one resource per class, but generally does need to be populated 048 * for client implementations. 049 */ 050 // NB: Read, Search (maybe others) share this annotation, so update the javadocs everywhere 051 Class<? extends IBaseResource> type() default IBaseResource.class; 052 053 /** 054 * This method allows the return type for this method to be specified in a 055 * non-type-specific way, using the text name of the resource, e.g. "Patient". 056 * 057 * This attribute should be populate, or {@link #type()} should be, but not both. 058 * 059 * @since 5.4.0 060 */ 061 String typeName() default ""; 062}