ImageObject.Builder
public final class ImageObject.Builder
Builder for ImageObject
.
Summary
Protected fields |
|
---|---|
List<String> |
|
@Nullable byte[] |
|
long |
|
String |
|
int |
|
long |
|
final String |
|
String |
|
final @NonNull List<Keyword> |
|
String |
|
final String |
|
List<PotentialAction> |
|
@Nullable String |
|
@Nullable String |
|
String |
Public constructors |
---|
Builder(@NonNull ImageObject copyFrom) Copy constructor. |
Constructor for an empty |
Public methods |
|
---|---|
@NonNull T |
addAlternateName(@NonNull String alternateName) Adds an alias for the item. |
@NonNull Self |
addKeyword(@NonNull Keyword keyword) Appends the |
@NonNull Self |
addKeyword(@NonNull String text) |
@NonNull Self |
addKeywords(@NonNull Iterable<Keyword> values) Appends all the |
@NonNull T |
@ExperimentalAppSearchApi Add a new action to the list of potential actions for this document. |
@NonNull ImageObject |
build() Builds a |
@NonNull Thing |
build() Builds a |
@NonNull T |
Clears the aliases, if any, for the item. |
@NonNull T |
Clear all the potential actions for this document. |
@NonNull T |
setAlternateNames(@Nullable List<String> alternateNames) Sets a list of aliases for the item. |
@NonNull Self |
Sets the byte representation of this image or video. |
@NonNull T |
setCreationTimestampMillis(long creationTimestampMillis) Sets the creation timestamp for the current AppSearch entity, in milliseconds using the |
@NonNull T |
setDescription(@Nullable String description) Sets the description for the item. |
@NonNull T |
setDocumentScore(int documentScore) Sets the user-provided opaque document score of the current AppSearch document, which can be used for ranking using |
@NonNull T |
setDocumentTtlMillis(long documentTtlMillis) Sets the time-to-live (TTL) for the current AppSearch document as a duration in milliseconds. |
@NonNull T |
Sets the URL for an image of the item. |
@NonNull T |
Sets the name of the item. |
@NonNull T |
@ExperimentalAppSearchApi Sets a list of potential actions for this document. |
@NonNull Self |
Sets the |
@NonNull Self |
setThumbnailSha256(@Nullable String text) Sets the |
@NonNull T |
Sets the deeplink URL of the item. |
Protected fields
Public constructors
Builder
public Builder(@NonNull String namespace, @NonNull String id)
Constructor for an empty Builder
.
Parameters | |
---|---|
@NonNull String namespace |
Namespace for the Document. See |
@NonNull String id |
Unique identifier for the Document. See |
Public methods
addAlternateName
public @NonNull T addAlternateName(@NonNull String alternateName)
Adds an alias for the item.
addKeyword
public @NonNull Self addKeyword(@NonNull Keyword keyword)
Appends the Keyword
.
addKeywords
public @NonNull Self addKeywords(@NonNull Iterable<Keyword> values)
Appends all the values
.
addPotentialAction
@ExperimentalAppSearchApi
public @NonNull T addPotentialAction(@NonNull PotentialAction newPotentialAction)
Add a new action to the list of potential actions for this document.
clearAlternateNames
public @NonNull T clearAlternateNames()
Clears the aliases, if any, for the item.
clearPotentialActions
@ExperimentalAppSearchApi
public @NonNull T clearPotentialActions()
Clear all the potential actions for this document.
setAlternateNames
public @NonNull T setAlternateNames(@Nullable List<String> alternateNames)
Sets a list of aliases for the item.
setBytes
public @NonNull Self setBytes(@Nullable byte[] bytes)
Sets the byte representation of this image or video.
setCreationTimestampMillis
public @NonNull T setCreationTimestampMillis(long creationTimestampMillis)
Sets the creation timestamp for the current AppSearch entity, in milliseconds using the 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 androidx.appsearch.annotation.Document.CreationTimestampMillis
for more information on creation timestamp.
setDescription
public @NonNull T setDescription(@Nullable String description)
Sets the description for the item.
setDocumentScore
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 RANKING_STRATEGY_DOCUMENT_SCORE
.
See androidx.appsearch.annotation.Document.Score
for more information on score.
setDocumentTtlMillis
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 androidx.appsearch.annotation.Document.TtlMillis
for more information on TTL.
setImage
@ExperimentalAppSearchApi
public @NonNull T setImage(@Nullable String image)
Sets the URL for an image of the item.
setName
public @NonNull T setName(@Nullable String name)
Sets the name of the item.
setPotentialActions
@ExperimentalAppSearchApi
public @NonNull T setPotentialActions(@Nullable List<PotentialAction> newPotentialActions)
Sets a list of potential actions for this document.
setSha256
public @NonNull Self setSha256(@Nullable String text)
Sets the sha256
.
setThumbnailSha256
public @NonNull Self setThumbnailSha256(@Nullable String text)
Sets the sha256
of the thumbnail of this image of video.
setUrl
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 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 ACTION_VIEW
intent with the url
as the setData
to view the item inside your application.
See Allowing Other Apps to Start Your Activity for more details on how to make activities in your app open for use by other apps by defining intent filters.