# A2uiDataPath

Artifact: [androidx.a2ui:a2ui-model](https://developer.android.com/jetpack/androidx/releases/a2ui) [View Source](https://cs.android.com/search?q=file:androidx/a2ui/model/protocol/A2uiDataPath.kt+class:androidx.a2ui.model.protocol.A2uiDataPath) Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

*** ** * ** ***


```
public final class A2uiDataPath
```

<br />

*** ** * ** ***

Parses JSON pointer strings (RFC 6901) into segments.

A JSON Pointer is a string syntax for identifying a specific value within a JSON document. This implementation aligns with the A2UI practices, which includes deviations from strict RFC 6901:

- Empty string `""` and `"/"` both evaluate to the root document (empty segments).

- A single trailing slash is stripped. (Note: To maintain parsing parity with other A2UI renderers, exactly one trailing slash is removed. e.g., "/foo//" evaluates to "/foo/").

- Missing leading slashes are permitted and represent relative paths.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#A2uiDataPath(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html path)` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#div(androidx.a2ui.model.protocol.A2uiDataPath)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath other)` Appends another `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath` to this path. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#div(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html other)` Appends a relative path segment `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#div(kotlin.String)` to this path. |
| `boolean` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#getNormalizedPath()()` The normalized, canonical JSON pointer string. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#getPath()()` The raw JSON pointer string passed during construction. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#getSegments()()` The decoded segments of the JSON pointer. |
| `int` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#isAbsolute()()` True if this path is absolute (starts with '/' or is empty representing root). |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#toString()()` |

## Public constructors

### A2uiDataPath

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
public A2uiDataPath(@NonNull String path)
```

## Public methods

### div

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
public final @NonNull A2uiDataPath div(@NonNull A2uiDataPath other)
```

Appends another `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath` to this path.

If `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#div(androidx.a2ui.model.protocol.A2uiDataPath)` is absolute, it replaces this path.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath other` | path to append |

### div

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
public final @NonNull A2uiDataPath div(@NonNull String other)
```

Appends a relative path segment `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#div(kotlin.String)` to this path.

If `https://developer.android.com/reference/androidx/a2ui/model/protocol/A2uiDataPath#div(kotlin.String)` starts with `/`, it is treated as an absolute path and replaces this path.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html other` | segment to append |

### equals

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

### getNormalizedPath

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
public final @NonNull String getNormalizedPath()
```

The normalized, canonical JSON pointer string.

### getPath

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
public final @NonNull String getPath()
```

The raw JSON pointer string passed during construction.

### getSegments

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
public final @NonNull List<@NonNull String> getSegments()
```

The decoded segments of the JSON pointer.

### hashCode

```
public int hashCode()
```

### isAbsolute

Added in [1.0.0-alpha02](https://developer.android.com/jetpack/androidx/releases/a2ui#1.0.0-alpha02)

```
public final boolean isAbsolute()
```

True if this path is absolute (starts with '/' or is empty representing root).

### toString

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