FhirResource.Builder


public static final class FhirResource.Builder
extends Object

java.lang.Object
   ↳ android.health.connect.datatypes.FhirResource.Builder


Builder class for FhirResource.

Summary

Public constructors

Builder(FhirResource other)

Constructs a clone of the other FhirResource instance.

Builder(FhirResource.Builder other)

Constructs a clone of the other FhirResource.Builder.

Builder(int type, String id, String data)

Constructs a new FhirResource.Builder instance.

Public methods

FhirResource build()

Returns a new instance of FhirResource with the specified parameters.

FhirResource.Builder setData(String data)

Sets the FHIR resource data in JSON representation.

FhirResource.Builder setId(String id)

Sets the FHIR resource ID.

FhirResource.Builder setType(int type)

Sets the FHIR resource type.

Inherited methods

Public constructors

Builder

public Builder (FhirResource other)

Constructs a clone of the other FhirResource instance.

Parameters
other FhirResource: This value cannot be null.

Builder

public Builder (FhirResource.Builder other)

Constructs a clone of the other FhirResource.Builder.

Parameters
other FhirResource.Builder: This value cannot be null.

Builder

public Builder (int type, 
                String id, 
                String data)

Constructs a new FhirResource.Builder instance.

Parameters
type int: The FHIR resource type extracted from the "resourceType" field in data. Value is FhirResource.FHIR_RESOURCE_TYPE_IMMUNIZATION, FhirResource.FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE, FhirResource.FHIR_RESOURCE_TYPE_OBSERVATION, FhirResource.FHIR_RESOURCE_TYPE_CONDITION, FhirResource.FHIR_RESOURCE_TYPE_PROCEDURE, FhirResource.FHIR_RESOURCE_TYPE_MEDICATION, FhirResource.FHIR_RESOURCE_TYPE_MEDICATION_REQUEST, FhirResource.FHIR_RESOURCE_TYPE_MEDICATION_STATEMENT, FhirResource.FHIR_RESOURCE_TYPE_PATIENT, FhirResource.FHIR_RESOURCE_TYPE_PRACTITIONER, FhirResource.FHIR_RESOURCE_TYPE_PRACTITIONER_ROLE, FhirResource.FHIR_RESOURCE_TYPE_ENCOUNTER, FhirResource.FHIR_RESOURCE_TYPE_LOCATION, or FhirResource.FHIR_RESOURCE_TYPE_ORGANIZATION

id String: The FHIR resource ID extracted from the "id" field in data. This value cannot be null.

data String: The FHIR resource data in JSON representation. This value cannot be null.

Throws
IllegalArgumentException if the provided FHIR resource type is not a valid supported type.

Public methods

build

public FhirResource build ()

Returns a new instance of FhirResource with the specified parameters.

Returns
FhirResource This value cannot be null.

setData

public FhirResource.Builder setData (String data)

Sets the FHIR resource data in JSON representation.

Parameters
data String: This value cannot be null.

Returns
FhirResource.Builder This value cannot be null.

setId

public FhirResource.Builder setId (String id)

Sets the FHIR resource ID. This is extracted from the "id" field in data. This is NOT a unique identifier among all FhirResources.

Parameters
id String: This value cannot be null.

Returns
FhirResource.Builder This value cannot be null.

setType

public FhirResource.Builder setType (int type)

Sets the FHIR resource type. This is extracted from the "resourceType" field in data.

Parameters
type int: Value is FhirResource.FHIR_RESOURCE_TYPE_IMMUNIZATION, FhirResource.FHIR_RESOURCE_TYPE_ALLERGY_INTOLERANCE, FhirResource.FHIR_RESOURCE_TYPE_OBSERVATION, FhirResource.FHIR_RESOURCE_TYPE_CONDITION, FhirResource.FHIR_RESOURCE_TYPE_PROCEDURE, FhirResource.FHIR_RESOURCE_TYPE_MEDICATION, FhirResource.FHIR_RESOURCE_TYPE_MEDICATION_REQUEST, FhirResource.FHIR_RESOURCE_TYPE_MEDICATION_STATEMENT, FhirResource.FHIR_RESOURCE_TYPE_PATIENT, FhirResource.FHIR_RESOURCE_TYPE_PRACTITIONER, FhirResource.FHIR_RESOURCE_TYPE_PRACTITIONER_ROLE, FhirResource.FHIR_RESOURCE_TYPE_ENCOUNTER, FhirResource.FHIR_RESOURCE_TYPE_LOCATION, or FhirResource.FHIR_RESOURCE_TYPE_ORGANIZATION

Returns
FhirResource.Builder This value cannot be null.

Throws
IllegalArgumentException if the provided FHIR resource type is not a valid supported type.