Package ca.uhn.fhir.rest.server.method
Class BaseMethodBinding<T>
- java.lang.Object
-
- ca.uhn.fhir.rest.server.method.BaseMethodBinding<T>
-
- Direct Known Subclasses:
BaseOutcomeReturningMethodBindingWithResourceIdButNoResourceBody,BaseResourceReturningMethodBinding,CreateMethodBinding,GraphQLMethodBinding,UpdateMethodBinding
public abstract class BaseMethodBinding<T> extends Object
-
-
Constructor Summary
Constructors Constructor Description BaseMethodBinding(Method theMethod, ca.uhn.fhir.context.FhirContext theContext, Object theProvider)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static BaseMethodBinding<?>bindMethod(Method theMethod, ca.uhn.fhir.context.FhirContext theContext, Object theProvider)protected Object[]createMethodParams(RequestDetails theRequest)protected Object[]createParametersForServerRequest(RequestDetails theRequest)List<Class<?>>getAllowableParamAnnotations()ca.uhn.fhir.context.FhirContextgetContext()Set<String>getIncludes()MethodgetMethod()List<IParameter>getParameters()ObjectgetProvider()Set<ca.uhn.fhir.model.api.Include>getRequestIncludesFromParams(Object[] params)abstract StringgetResourceName()Returns the name of the resource this method handles, ornullif this method is not resource specificabstract ca.uhn.fhir.rest.api.RestOperationTypeEnumgetRestOperationType()ca.uhn.fhir.rest.api.RestOperationTypeEnumgetRestOperationType(RequestDetails theRequestDetails)Determine which operation is being fired for a specific requestabstract booleanincomingServerRequestMatchesMethod(RequestDetails theRequest)abstract ObjectinvokeServer(IRestfulServer<?> theServer, RequestDetails theRequest)protected ObjectinvokeServerMethod(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams)booleanisGlobalMethod()Subclasses may override to declare that they apply to all resource typesbooleanisSupportsConditional()Does this method have a parameter annotated withConditionalParamBinder.booleanisSupportsConditionalMultiple()Does this method support conditional operations over multiple objects (basically for conditional delete)protected voidpopulateActionRequestDetailsForInterceptor(RequestDetails theRequestDetails, IServerInterceptor.ActionRequestDetails theDetails, Object[] theMethodParams)Subclasses may override this method (but should also call super.populateActionRequestDetailsForInterceptor(RequestDetails, ActionRequestDetails, Object[])to provide method specifics to the interceptors.voidsetParameters(List<IParameter> theParameters)For unit tests onlyprotected IBundleProvidertoResourceList(Object response)static booleanverifyMethodHasZeroOrOneOperationAnnotation(Method theNextMethod, Object... theAnnotations)
-
-
-
Constructor Detail
-
BaseMethodBinding
public BaseMethodBinding(Method theMethod, ca.uhn.fhir.context.FhirContext theContext, Object theProvider)
-
-
Method Detail
-
createMethodParams
protected Object[] createMethodParams(RequestDetails theRequest)
-
createParametersForServerRequest
protected Object[] createParametersForServerRequest(RequestDetails theRequest)
-
isGlobalMethod
public boolean isGlobalMethod()
Subclasses may override to declare that they apply to all resource types
-
getAllowableParamAnnotations
public List<Class<?>> getAllowableParamAnnotations()
-
getContext
public ca.uhn.fhir.context.FhirContext getContext()
-
getIncludes
public Set<String> getIncludes()
-
getParameters
public List<IParameter> getParameters()
-
setParameters
public void setParameters(List<IParameter> theParameters)
For unit tests only
-
getProvider
public Object getProvider()
-
getRequestIncludesFromParams
public Set<ca.uhn.fhir.model.api.Include> getRequestIncludesFromParams(Object[] params)
-
getResourceName
public abstract String getResourceName()
Returns the name of the resource this method handles, ornullif this method is not resource specific
-
getRestOperationType
@Nonnull public abstract ca.uhn.fhir.rest.api.RestOperationTypeEnum getRestOperationType()
-
getRestOperationType
public ca.uhn.fhir.rest.api.RestOperationTypeEnum getRestOperationType(RequestDetails theRequestDetails)
Determine which operation is being fired for a specific request- Parameters:
theRequestDetails- The request
-
incomingServerRequestMatchesMethod
public abstract boolean incomingServerRequestMatchesMethod(RequestDetails theRequest)
-
invokeServer
public abstract Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException, IOException
- Throws:
ca.uhn.fhir.rest.server.exceptions.BaseServerResponseExceptionIOException
-
invokeServerMethod
protected final Object invokeServerMethod(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams)
-
isSupportsConditional
public boolean isSupportsConditional()
Does this method have a parameter annotated withConditionalParamBinder. Note that many operations don't actually support this paramter, so this will only return true occasionally.
-
isSupportsConditionalMultiple
public boolean isSupportsConditionalMultiple()
Does this method support conditional operations over multiple objects (basically for conditional delete)
-
populateActionRequestDetailsForInterceptor
protected void populateActionRequestDetailsForInterceptor(RequestDetails theRequestDetails, IServerInterceptor.ActionRequestDetails theDetails, Object[] theMethodParams)
Subclasses may override this method (but should also call super.populateActionRequestDetailsForInterceptor(RequestDetails, ActionRequestDetails, Object[])to provide method specifics to the interceptors.- Parameters:
theRequestDetails- The server request detailstheDetails- The details object to populatetheMethodParams- The method params as generated by the specific method binding
-
toResourceList
protected IBundleProvider toResourceList(Object response) throws ca.uhn.fhir.rest.server.exceptions.InternalErrorException
- Throws:
ca.uhn.fhir.rest.server.exceptions.InternalErrorException
-
bindMethod
public static BaseMethodBinding<?> bindMethod(Method theMethod, ca.uhn.fhir.context.FhirContext theContext, Object theProvider)
-
verifyMethodHasZeroOrOneOperationAnnotation
public static boolean verifyMethodHasZeroOrOneOperationAnnotation(Method theNextMethod, Object... theAnnotations)
-
-