Package de.gematik.bbriccs.rest.fd
Class FdResponse<R extends org.hl7.fhir.r4.model.Resource>
java.lang.Object
de.gematik.bbriccs.rest.fd.FdResponse<R>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classFdResponse.ErpResponseBuilder<E extends org.hl7.fhir.r4.model.Resource> -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends org.hl7.fhir.r4.model.Resource>
FdResponse.ErpResponseBuilder<E>forPayload(Class<E> expectType, org.hl7.fhir.r4.model.Resource resource) org.hl7.fhir.r4.model.ResourceThis will retrieve the FHIR Payload Resource as the Base-Class without any validation.org.hl7.fhir.r4.model.OperationOutcomelong<E extends RuntimeException>
RgetExpectedOrThrow(Function<FdResponse<? extends org.hl7.fhir.r4.model.Resource>, E> errorFunction) Extract the Resource from the Response or throw a custom Exception if the Resource is not of the expected typegetHeaderValue(String key) <U extends org.hl7.fhir.r4.model.Resource>
Optional<U>getResourceOptional(Class<U> clazz) Class<? extends org.hl7.fhir.r4.model.Resource>booleanbooleanisJson()booleanbooleanbooleanisResourceOfType(Class<? extends org.hl7.fhir.r4.model.Resource> clazz) booleanbooleanisXML()toString()
-
Method Details
-
forPayload
public static <E extends org.hl7.fhir.r4.model.Resource> FdResponse.ErpResponseBuilder<E> forPayload(Class<E> expectType, @Nullable org.hl7.fhir.r4.model.Resource resource) -
isValidPayload
public boolean isValidPayload() -
getAsBaseResource
@Nullable public org.hl7.fhir.r4.model.Resource getAsBaseResource()This will retrieve the FHIR Payload Resource as the Base-Class without any validation.- Returns:
- the FHIR Payload as an untyped Resource
-
getAsOperationOutcome
public org.hl7.fhir.r4.model.OperationOutcome getAsOperationOutcome() -
getExpectedResource
-
getExpectedOrThrow
public <E extends RuntimeException> R getExpectedOrThrow(Function<FdResponse<? extends org.hl7.fhir.r4.model.Resource>, E> errorFunction) Extract the Resource from the Response or throw a custom Exception if the Resource is not of the expected type- Type Parameters:
E- the type of the custom exception to be thrown if the Resource is not of the expected type- Parameters:
errorFunction- mapping the ErpResponse to a custom Exception- Returns:
- the Resource
-
getResourceOptional
-
getResourceOptional
-
getResourceType
-
isResourceOfType
-
isOfExpectedType
public boolean isOfExpectedType() -
isOperationOutcome
public boolean isOperationOutcome() -
isEmptyBody
public boolean isEmptyBody() -
getHeaderValue
-
getHeaderValue
-
getContentType
-
getContentLength
public long getContentLength() -
isJson
public boolean isJson() -
isXML
public boolean isXML() -
toString
-