# FhirVersion

Artifact: [androidx.health.connect:connect-client](https://developer.android.com/jetpack/androidx/releases/health-connect) [View Source](https://cs.android.com/search?q=file:androidx/health/connect/client/records/FhirVersion.kt+class:androidx.health.connect.client.records.FhirVersion) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

*** ** * ** ***


```
@ExperimentalPersonalHealthRecordApi
public final class FhirVersion implements Comparable<@NonNull FhirVersion>
```

<br />

*** ** * ** ***

Represents the FHIR version. This is designed according to [the official FHIR versions](https://build.fhir.org/versions.html#versions) of the Fast Healthcare Interoperability Resources (FHIR) standard. "label", which represents a 'working' version, is not supported for now.

The versions R4 (4.0.1) and R4B (4.3.0) are supported in Health Connect. Use `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#isSupportedFhirVersion()` to check whether a FHIR version is supported.

This feature is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument. An `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unsupported-operation-exception/index.html` would be thrown if the feature is not available.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#FhirVersion(kotlin.Int,kotlin.Int,kotlin.Int)(int major, int minor, int patch)` |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#compareTo(androidx.health.connect.client.records.FhirVersion)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion other)` |
| `boolean` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#getMajor()()` |
| `final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#getMinor()()` |
| `final int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#getPatch()()` |
| `int` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#isSupportedFhirVersion()()` Returns `true` if this `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion` is supported, `false` otherwise. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#parseFhirVersion(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html fhirVersionString)` Creates a `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion` object with the version of string format. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion#toString()()` |

## Public constructors

### FhirVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public FhirVersion(int major, int minor, int patch)
```

## Public methods

### compareTo

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public int compareTo(@NonNull FhirVersion other)
```

### equals

```
public boolean equals(Object other)
```

### getMajor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public final int getMajor()
```

### getMinor

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public final int getMinor()
```

### getPatch

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public final int getPatch()
```

### hashCode

```
public int hashCode()
```

### isSupportedFhirVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public final boolean isSupportedFhirVersion()
```

Returns `true` if this `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion` is supported, `false` otherwise.

This method is dependent on the version of HealthConnect installed on the device. To check if it's available call `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#getFeatureStatus(kotlin.Int)` and pass `https://developer.android.com/reference/androidx/health/connect/client/HealthConnectFeatures#FEATURE_PERSONAL_HEALTH_RECORD()` as an argument.

### parseFhirVersion

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/health-connect#1.1.0)

```
public static final @NonNull FhirVersion parseFhirVersion(@NonNull String fhirVersionString)
```

Creates a `https://developer.android.com/reference/androidx/health/connect/client/records/FhirVersion` object with the version of string format.

The format should look like "4.0.1" which contains 3 numbers - major, minor and patch, separated by ".". This aligns with [the official FHIR versions](https://build.fhir.org/versions.html#versions). Note that the "label" is not supported for now, which represents a 'working' version.

### toString

```
public @NonNull String toString()
```