# Thing.BuilderBase

Artifact: [androidx.appsearch:appsearch-builtin-types](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/builtintypes/Thing.java+class:androidx.appsearch.builtintypes.Thing.BuilderBase) Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

*** ** * ** ***


```
@ExperimentalAppSearchApi
public class Thing.BuilderBase<T extends Thing.BuilderBase<T>>
```

<br />

Known direct subclasses [Alarm.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.BuilderBase), [AlarmInstance.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance.BuilderBase), [ContactPoint.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/ContactPoint.BuilderBase), [Event.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Event.BuilderBase), [ImageObject.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/ImageObject.BuilderBase), [MobileApplication.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/MobileApplication.BuilderBase), [Organization.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Organization.BuilderBase), [Person.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Person.BuilderBase), [Stopwatch.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Stopwatch.BuilderBase), [StopwatchLap.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/StopwatchLap.BuilderBase), [Thing.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.Builder), [Timer.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase), [WebPage.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/WebPage.BuilderBase)

|---|---|
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/ContactPoint.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Event.BuilderBase` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Event`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/ImageObject.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/MobileApplication.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Organization.BuilderBase` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Organization`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Person.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Stopwatch.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/StopwatchLap.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/WebPage.BuilderBase` |   |

Known indirect subclasses [Alarm.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.Builder), [AlarmInstance.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance.Builder), [ContactPoint.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/ContactPoint.Builder), [Event.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/Event.Builder), [ImageObject.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/ImageObject.Builder), [MobileApplication.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/MobileApplication.Builder), [Organization.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/Organization.Builder), [Person.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/Person.Builder), [SportsEvent.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsEvent.BuilderBase), [SportsEvent.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsEvent.Builder), [SportsOrganization.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsOrganization.BuilderBase), [SportsOrganization.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsOrganization.Builder), [SportsTeam.BuilderBase](https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsTeam.BuilderBase), [SportsTeam.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsTeam.Builder), [Stopwatch.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/Stopwatch.Builder), [StopwatchLap.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/StopwatchLap.Builder), [Timer.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.Builder), [WebPage.Builder](https://developer.android.com/reference/androidx/appsearch/builtintypes/WebPage.Builder)

|---|---|
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Alarm`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/AlarmInstance`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/ContactPoint.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/ContactPoint`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Event.Builder` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/ImageObject.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/ImageObject`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/MobileApplication.Builder` | Builder class for `https://developer.android.com/reference/androidx/appsearch/builtintypes/MobileApplication`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Organization.Builder` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Person.Builder` | Builder class for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Person`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsEvent.BuilderBase` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsEvent.Builder` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsOrganization.BuilderBase` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsOrganization`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsOrganization.Builder` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsTeam.BuilderBase` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsTeam`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/SportsTeam.Builder` |   |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Stopwatch.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Stopwatch`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/StopwatchLap.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/StopwatchLap`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Timer`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/WebPage.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/builtintypes/WebPage`. |

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#BuilderBase(androidx.appsearch.builtintypes.Thing)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing thing)` Constructor for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase` from existing values in given `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing`. |
| `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#BuilderBase(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 namespace, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id)` Constructor for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#addAlternateName(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html alternateName)` Adds an alias for the item. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#addPotentialAction(androidx.appsearch.builtintypes.PotentialAction)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/PotentialAction newPotentialAction)` Add a new action to the list of potential actions for this document. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#build()()` Builds a `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing` object. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#clearAlternateNames()()` Clears the aliases, if any, for the item. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#clearPotentialActions()()` Clear all the potential actions for this document. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setAlternateNames(java.util.List<java.lang.String>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/String.html> alternateNames)` Sets a list of aliases for the item. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setCreationTimestampMillis(long)(long creationTimestampMillis)` Sets the creation timestamp for the current AppSearch entity, in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setDescription(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html description)` Sets the description for the item. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setDocumentScore(int)(int documentScore)` Sets the user-provided opaque document score of the current AppSearch document, which can be used for ranking using `https://developer.android.com/reference/androidx/appsearch/app/SearchSpec#RANKING_STRATEGY_DOCUMENT_SCORE()`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setDocumentTtlMillis(long)(long documentTtlMillis)` Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setImage(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html image)` Sets the URL for an image of the item. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setName(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html name)` Sets the name of the item. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setPotentialActions(java.util.List<androidx.appsearch.builtintypes.PotentialAction>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/appsearch/builtintypes/PotentialAction> newPotentialActions)` Sets a list of potential actions for this document. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#setUrl(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html url)` Sets the deeplink URL of the item. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase#resetIfBuilt()()` If built, make a copy of previous data for every field so that the builder can be reused. |

## Public constructors

### BuilderBase

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

```
public BuilderBase(@NonNull Thing thing)
```

Constructor for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase` from existing values in given `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing thing` | The existing `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing` to copy values from. |

### BuilderBase

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

```
public BuilderBase(@NonNull String namespace, @NonNull String id)
```

Constructor for `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing.BuilderBase`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace` | Namespace for the Document. See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.Namespace`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id` | Unique identifier for the Document. See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.Id`. |

## Public methods

### addAlternateName

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

```
public @NonNull T addAlternateName(@NonNull String alternateName)
```

Adds an alias for the item.

### addPotentialAction

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

```
@ExperimentalAppSearchApi
public @NonNull T addPotentialAction(@NonNull PotentialAction newPotentialAction)
```

Add a new action to the list of potential actions for this document.

### build

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

```
public @NonNull Thing build()
```

Builds a `https://developer.android.com/reference/androidx/appsearch/builtintypes/Thing` object.

### clearAlternateNames

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

```
public @NonNull T clearAlternateNames()
```

Clears the aliases, if any, for the item.

### clearPotentialActions

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

```
@ExperimentalAppSearchApi
public @NonNull T clearPotentialActions()
```

Clear all the potential actions for this document.

### setAlternateNames

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

```
public @NonNull T setAlternateNames(@Nullable List<String> alternateNames)
```

Sets a list of aliases for the item.

### setCreationTimestampMillis

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

```
public @NonNull T setCreationTimestampMillis(long creationTimestampMillis)
```

Sets the creation timestamp for the current AppSearch entity, in milliseconds using the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base.

This timestamp refers to the creation time of the AppSearch entity, not when the document is written into AppSearch.

If not set, then the current timestamp will be used.

See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.CreationTimestampMillis` for more information on creation timestamp.

### setDescription

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

```
public @NonNull T setDescription(@Nullable String description)
```

Sets the description for the item.

### setDocumentScore

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

```
public @NonNull T setDocumentScore(int documentScore)
```

Sets the user-provided opaque document score of the current AppSearch document, which can be used for ranking using `https://developer.android.com/reference/androidx/appsearch/app/SearchSpec#RANKING_STRATEGY_DOCUMENT_SCORE()`.

See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.Score` for more information on score.

### setDocumentTtlMillis

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

```
public @NonNull T setDocumentTtlMillis(long documentTtlMillis)
```

Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds.

The document will be automatically deleted when the TTL expires.

If not set, then the document will never expire.

See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.TtlMillis` for more information on TTL.

### setImage

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

```
@ExperimentalAppSearchApi
public @NonNull T setImage(@Nullable String image)
```

Sets the URL for an image of the item.

### setName

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

```
public @NonNull T setName(@Nullable String name)
```

Sets the name of the item.

### setPotentialActions

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

```
@ExperimentalAppSearchApi
public @NonNull T setPotentialActions(@Nullable List<PotentialAction> newPotentialActions)
```

Sets a list of potential actions for this document.

### setUrl

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

```
public @NonNull T setUrl(@Nullable String url)
```

Sets the deeplink URL of the item.

If this item can be displayed by any system UI surface, or can be read by another Android package, through one of the `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder` methods, this `url` should act as a deeplink into the activity that can open it. Callers should be able to construct an `https://developer.android.com/reference/android/content/Intent.html#ACTION_VIEW` intent with the `url` as the `https://developer.android.com/reference/android/content/Intent.html#setData(android.net.Uri)` to view the item inside your application.

See [Allowing Other Apps to Start Your Activity](https://training/basics/intents/filters) for more details on how to make activities in your app open for use by other apps by defining intent filters.

## Protected methods

### resetIfBuilt

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

```
protected void resetIfBuilt()
```

If built, make a copy of previous data for every field so that the builder can be reused.