# 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
class Thing.BuilderBase<T : Thing.BuilderBase<T!>?>
```

<br />

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

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

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

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

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#BuilderBase(androidx.appsearch.builtintypes.Thing)(thing: https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing)` Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase` from existing values in given `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase#BuilderBase(java.lang.String,java.lang.String)(namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing.BuilderBase`. |

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

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/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)

```
BuilderBase(thing: Thing)
```

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

| Parameters |
|---|---|
| `thing: https://developer.android.com/reference/kotlin/androidx/appsearch/builtintypes/Thing` | The existing `https://developer.android.com/reference/kotlin/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)

```
BuilderBase(namespace: String, id: String)
```

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

| Parameters |
|---|---|
| `namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Namespace for the Document. See `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document.Namespace`. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Unique identifier for the Document. See `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document.Id`. |

## Public functions

### addAlternateName

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

```
fun addAlternateName(alternateName: String): T
```

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
fun addPotentialAction(newPotentialAction: PotentialAction): T
```

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)

```
fun build(): Thing
```

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

### clearAlternateNames

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

```
fun clearAlternateNames(): T
```

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
fun clearPotentialActions(): T
```

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)

```
fun setAlternateNames(alternateNames: (Mutable)List<String!>?): T
```

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)

```
fun setCreationTimestampMillis(creationTimestampMillis: Long): T
```

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/kotlin/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)

```
fun setDescription(description: String?): T
```

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)

```
fun setDocumentScore(documentScore: Int): T
```

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

See `https://developer.android.com/reference/kotlin/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)

```
fun setDocumentTtlMillis(documentTtlMillis: Long): T
```

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/kotlin/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
fun setImage(image: String?): T
```

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)

```
fun setName(name: String?): T
```

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
fun setPotentialActions(
    newPotentialActions: (Mutable)List<PotentialAction!>?
): T
```

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)

```
fun setUrl(url: String?): T
```

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/kotlin/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 functions

### resetIfBuilt

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

```
protected fun resetIfBuilt(): Unit
```

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