MedicalResource.Builder


public static final class MedicalResource.Builder
extends Object

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


Builder class for MedicalResource.

Summary

Public constructors

Builder(MedicalResource other)

Constructs a clone of the other MedicalResource instance.

Builder(MedicalResource.Builder other)

Constructs a clone of the other MedicalResource.Builder.

Builder(int type, String dataSourceId, FhirVersion fhirVersion, FhirResource fhirResource)

Constructs a new MedicalResource.Builder instance.

Public methods

MedicalResource build()

Returns a new instance of MedicalResource with the specified parameters.

MedicalResource.Builder setDataSourceId(String dataSourceId)

Sets the unique MedicalDataSource ID of where the data comes from.

MedicalResource.Builder setFhirResource(FhirResource fhirResource)

Sets the enclosed FhirResource object.

MedicalResource.Builder setFhirVersion(FhirVersion fhirVersion)

Sets the FHIR version being used for fhirResource.

MedicalResource.Builder setType(int type)

Sets the medical resource type.

Inherited methods

Public constructors

Builder

public Builder (MedicalResource other)

Constructs a clone of the other MedicalResource instance.

Parameters
other MedicalResource: This value cannot be null.

Builder

public Builder (MedicalResource.Builder other)

Constructs a clone of the other MedicalResource.Builder.

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

Builder

public Builder (int type, 
                String dataSourceId, 
                FhirVersion fhirVersion, 
                FhirResource fhirResource)

Constructs a new MedicalResource.Builder instance.

Parameters
type int: The medical resource type. Value is MedicalResource.MEDICAL_RESOURCE_TYPE_ALLERGIES_INTOLERANCES, MedicalResource.MEDICAL_RESOURCE_TYPE_CONDITIONS, MedicalResource.MEDICAL_RESOURCE_TYPE_LABORATORY_RESULTS, MedicalResource.MEDICAL_RESOURCE_TYPE_MEDICATIONS, MedicalResource.MEDICAL_RESOURCE_TYPE_PERSONAL_DETAILS, MedicalResource.MEDICAL_RESOURCE_TYPE_PRACTITIONER_DETAILS, MedicalResource.MEDICAL_RESOURCE_TYPE_PREGNANCY, MedicalResource.MEDICAL_RESOURCE_TYPE_PROCEDURES, MedicalResource.MEDICAL_RESOURCE_TYPE_SOCIAL_HISTORY, MedicalResource.MEDICAL_RESOURCE_TYPE_VACCINES, MedicalResource.MEDICAL_RESOURCE_TYPE_VISITS, or MedicalResource.MEDICAL_RESOURCE_TYPE_VITAL_SIGNS

dataSourceId String: The unique MedicalDataSource ID of where the data comes from. This value cannot be null.

fhirVersion FhirVersion: the FHIR version being used for fhirResource. This value cannot be null.

fhirResource FhirResource: The enclosed FhirResource object. This value cannot be null.

Throws
IllegalArgumentException if the provided medical resource type is not a valid supported type, or dataSourceId is not a valid ID.

Public methods

build

public MedicalResource build ()

Returns a new instance of MedicalResource with the specified parameters.

Returns
MedicalResource This value cannot be null.

setDataSourceId

public MedicalResource.Builder setDataSourceId (String dataSourceId)

Sets the unique MedicalDataSource ID of where the data comes from.

Parameters
dataSourceId String: This value cannot be null.

Returns
MedicalResource.Builder This value cannot be null.

Throws
IllegalArgumentException if the provided dataSourceId is not a valid ID.

setFhirResource

public MedicalResource.Builder setFhirResource (FhirResource fhirResource)

Sets the enclosed FhirResource object.

Parameters
fhirResource FhirResource: This value cannot be null.

Returns
MedicalResource.Builder This value cannot be null.

setFhirVersion

public MedicalResource.Builder setFhirVersion (FhirVersion fhirVersion)

Sets the FHIR version being used for fhirResource.

Parameters
fhirVersion FhirVersion: This value cannot be null.

Returns
MedicalResource.Builder This value cannot be null.

setType

public MedicalResource.Builder setType (int type)

Sets the medical resource type.

Parameters
type int: Value is MedicalResource.MEDICAL_RESOURCE_TYPE_ALLERGIES_INTOLERANCES, MedicalResource.MEDICAL_RESOURCE_TYPE_CONDITIONS, MedicalResource.MEDICAL_RESOURCE_TYPE_LABORATORY_RESULTS, MedicalResource.MEDICAL_RESOURCE_TYPE_MEDICATIONS, MedicalResource.MEDICAL_RESOURCE_TYPE_PERSONAL_DETAILS, MedicalResource.MEDICAL_RESOURCE_TYPE_PRACTITIONER_DETAILS, MedicalResource.MEDICAL_RESOURCE_TYPE_PREGNANCY, MedicalResource.MEDICAL_RESOURCE_TYPE_PROCEDURES, MedicalResource.MEDICAL_RESOURCE_TYPE_SOCIAL_HISTORY, MedicalResource.MEDICAL_RESOURCE_TYPE_VACCINES, MedicalResource.MEDICAL_RESOURCE_TYPE_VISITS, or MedicalResource.MEDICAL_RESOURCE_TYPE_VITAL_SIGNS

Returns
MedicalResource.Builder This value cannot be null.

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