001package ca.uhn.fhir.rest.annotation; 002 003/* 004 * #%L 005 * HAPI FHIR - Core Library 006 * %% 007 * Copyright (C) 2014 - 2016 University Health Network 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import java.lang.annotation.ElementType; 024import java.lang.annotation.Retention; 025import java.lang.annotation.RetentionPolicy; 026import java.lang.annotation.Target; 027 028import org.hl7.fhir.instance.model.api.IBase; 029 030import ca.uhn.fhir.model.primitive.StringDt; 031import ca.uhn.fhir.rest.param.StringParam; 032 033/** 034 */ 035@Retention(RetentionPolicy.RUNTIME) 036@Target(value=ElementType.PARAMETER) 037public @interface OperationParam { 038 039 /** 040 * Value for {@link OperationParam#max()} indicating no maximum 041 */ 042 final int MAX_UNLIMITED = -1; 043 044 /** 045 * The name of the parameter 046 */ 047 String name(); 048 049 /** 050 * The type of the parameter. This will only have effect on <code>@OperationParam</code> 051 * annotations specified as values for {@link Operation#returnParameters()}, otherwise the 052 * value will be ignored. Value should be one of: 053 * <ul> 054 * <li>A resource type, e.g. <code>Patient.class</code></li> 055 * <li>A datatype, e.g. <code>{@link StringDt}.class</code> or </code>CodeableConceptDt.class</code> 056 * <li>A RESTful search parameter type, e.g. <code>{@link StringParam}.class</code> 057 * </ul> 058 */ 059 Class<? extends IBase> type() default IBase.class; 060 061 /** 062 * The minimum number of repetitions allowed for this child (default is 0) 063 */ 064 int min() default 0; 065 066 /** 067 * The maximum number of repetitions allowed for this child. Should be 068 * set to {@link #MAX_UNLIMITED} if there is no limit to the number of 069 * repetitions (default is 1) 070 */ 071 int max() default 1; 072 073 074}