# DocumentIdUtil

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/util/DocumentIdUtil.java+class:androidx.appsearch.util.DocumentIdUtil) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
public class DocumentIdUtil
```

<br />

*** ** * ** ***

A util class with methods for working with document ids.

## Summary

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/util/DocumentIdUtil#createQualifiedId(java.lang.String,java.lang.String,androidx.appsearch.app.GenericDocument)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html databaseName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/app/GenericDocument document )` Generates a qualified id based on package, database, and a `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/util/DocumentIdUtil#createQualifiedId(java.lang.String,java.lang.String,java.lang.String,java.lang.String)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html databaseName, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id )` Generates a qualified id based on package, database, namespace, and doc id. |

## Public methods

### createQualifiedId

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

```
public static @NonNull String createQualifiedId(
    @NonNull String packageName,
    @NonNull String databaseName,
    @NonNull GenericDocument document
)
```

Generates a qualified id based on package, database, and a `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName` | The package the document belongs to. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html databaseName` | The database containing the document. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/app/GenericDocument document` | The document to generate a qualified id for. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | the qualified id of a document. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/util/DocumentIdUtil#createQualifiedId(java.lang.String,java.lang.String,java.lang.String,java.lang.String)` |   |

### createQualifiedId

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

```
public static @NonNull String createQualifiedId(
    @NonNull String packageName,
    @NonNull String databaseName,
    @NonNull String namespace,
    @NonNull String id
)
```

Generates a qualified id based on package, database, namespace, and doc id.

A qualified id is a String referring to the combined package name, database name, namespace, and id of the document. It is useful for linking one document to another in order to perform a join operation with `https://developer.android.com/reference/androidx/appsearch/app/JoinSpec`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName` | The package the document belongs to. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html databaseName` | The database containing the document. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace` | The namespace of the document. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id` | The id of the document. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | the qualified id of a document |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/app/JoinSpec` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/JoinSpec#QUALIFIED_ID()` |   |