001/*
002 * #%L
003 * HAPI FHIR - Server Framework
004 * %%
005 * Copyright (C) 2014 - 2024 Smile CDR, Inc.
006 * %%
007 * Licensed under the Apache License, Version 2.0 (the "License");
008 * you may not use this file except in compliance with the License.
009 * You may obtain a copy of the License at
010 *
011 *      http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 * #L%
019 */
020package ca.uhn.fhir.rest.server.method;
021
022import ca.uhn.fhir.model.api.IResource;
023import ca.uhn.fhir.rest.api.server.RequestDetails;
024import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
025import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
026
027import java.lang.reflect.Method;
028import java.util.Collection;
029
030public interface IParameter {
031
032        /**
033         * This <b>server method</b> method takes the data received by the server in an incoming request, and translates that data into a single argument for a server method invocation. Note that all
034         * received data is passed to this method, but the expectation is that not necessarily that all data is used by every parameter.
035         *
036         * @param theRequest
037         *            The incoming request object
038         * @param theRequestContents
039         *            The parsed contents of the incoming request. E.g. if the request was an HTTP POST with a resource in the body, this argument would contain the parsed {@link IResource} instance.
040         * @param theMethodBinding TODO
041         * @return Returns the argument object as it will be passed to the IResourceProvider method.
042         */
043        Object translateQueryParametersIntoServerArgument(RequestDetails theRequest, BaseMethodBinding theMethodBinding)
044                        throws InternalErrorException, InvalidRequestException;
045
046        void initializeTypes(
047                        Method theMethod,
048                        Class<? extends Collection<?>> theOuterCollectionType,
049                        Class<? extends Collection<?>> theInnerCollectionType,
050                        Class<?> theParameterType);
051}