@Document.BuilderProducer
public final class SportsEvent.Builder


Summary

Public constructors

Builder(@NonNull SportsEvent sportsEvent)

Constructor with all the existing values.

Builder(
    @NonNull String namespace,
    @NonNull String id,
    @NonNull Instant startDate,
    @NonNull String sport,
    @NonNull SportsTeam homeTeam,
    @NonNull SportsTeam awayTeam
)

Constructor for SportsEvent.Builder.

Public methods

@NonNull T

Adds an alias for the item.

@NonNull T

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

@NonNull SportsEvent

Builds a Thing object.

@NonNull Event

Builds a Thing object.

@NonNull Thing

Builds a Thing object.

@NonNull T

Clears the aliases, if any, for the item.

@NonNull T

Clear all the potential actions for this document.

@NonNull T

Sets a list of aliases for the item.

@NonNull T
setAwayTeamAccessoryScore(@Nullable String awayTeamAccessoryScore)

Sets the away team accessory score of the sports event.

@NonNull T

Sets the away team score of the sports event.

@NonNull T
setAwayTeamWinProbability(double awayTeamWinProbability)

Sets the away team win probability of the sports event.

@NonNull T
setCreationTimestampMillis(long creationTimestampMillis)

Sets the creation timestamp for the current AppSearch entity, in milliseconds using the currentTimeMillis time base.

@NonNull T

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 RANKING_STRATEGY_DOCUMENT_SCORE.

@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 duration of the event as a Duration.

@NonNull T

Sets the end date of the event as a Instant.

@NonNull T
setGameTemporalState(@Nullable String gameTemporalState)

Sets the game temporal state of the sports event.

@NonNull T
setHomeTeamAccessoryScore(@Nullable String homeTeamAccessoryScore)

Sets the home team accessory score of the sports event.

@NonNull T

Sets the home team score of the sports event.

@NonNull T
setHomeTeamWinProbability(double homeTeamWinProbability)

Sets the home team win probability of the sports event.

@NonNull T

Sets the URL for an image of the item.

@NonNull T

Sets the location of the event.

@NonNull T

Sets the logo of the event.

@NonNull T

Sets the name of the item.

@NonNull T

Sets the most recent notable detail of the sports event.

@NonNull T

Sets the Organization of the sports event.

@NonNull T
setPlaceHomeTeamAtStart(boolean placeHomeTeamAtStart)

Sets whether the home team should be placed at the start for a visual representation of the sports event.

@NonNull T

Sets a list of potential actions for this document.

@NonNull T
setResult(long result)

Sets whether the home team won the sports event.

@NonNull T
setSportsEventStatus(long sportsEventStatus)

Sets the status of the sports event.

@NonNull T
setSportsEventStatusLabel(@Nullable String sportsEventStatusLabel)

Sets the status label of the sports event.

@NonNull T

Sets the deeplink URL of the item.

Protected fields

mAlternateNames

protected List<StringmAlternateNames

mAwayTeam

protected SportsTeam mAwayTeam

mAwayTeamAccessoryScore

protected @Nullable String mAwayTeamAccessoryScore

mAwayTeamScore

protected @Nullable String mAwayTeamScore

mAwayTeamWinProbability

protected double mAwayTeamWinProbability

mCreationTimestampMillis

protected long mCreationTimestampMillis

mDescription

protected String mDescription

mDocumentScore

protected int mDocumentScore

mDocumentTtlMillis

protected long mDocumentTtlMillis

mDuration

protected Duration mDuration

mEndDate

protected Instant mEndDate

mGameTemporalState

protected @Nullable String mGameTemporalState

mHomeTeam

protected SportsTeam mHomeTeam

mHomeTeamAccessoryScore

protected @Nullable String mHomeTeamAccessoryScore

mHomeTeamScore

protected @Nullable String mHomeTeamScore

mHomeTeamWinProbability

protected double mHomeTeamWinProbability

mId

protected final String mId

mImage

protected String mImage

mLocation

protected String mLocation

mLogo

protected ImageObject mLogo

mName

protected String mName

mNamespace

protected final String mNamespace

mNotableDetail

protected @Nullable String mNotableDetail

mOrganizer

protected @Nullable Organization mOrganizer

mPlaceHomeTeamAtStart

protected boolean mPlaceHomeTeamAtStart

mPotentialActions

protected List<PotentialActionmPotentialActions

mResult

protected long mResult

mSport

protected String mSport

mSportsEventStatus

protected long mSportsEventStatus

mSportsEventStatusLabel

protected @Nullable String mSportsEventStatusLabel

mStartDate

protected Instant mStartDate

mUrl

protected String mUrl

Public constructors

Builder

Added in 1.2.0-alpha01
public Builder(@NonNull SportsEvent sportsEvent)

Constructor with all the existing values.

Builder

Added in 1.2.0-alpha01
public Builder(
    @NonNull String namespace,
    @NonNull String id,
    @NonNull Instant startDate,
    @NonNull String sport,
    @NonNull SportsTeam homeTeam,
    @NonNull SportsTeam awayTeam
)

Constructor for SportsEvent.Builder.

Parameters
@NonNull String namespace

Namespace for the Document. See Document.Namespace.

@NonNull String id

Unique identifier for the Document. See Document.Id.

@NonNull Instant startDate

The start date of the sports event.

@NonNull String sport

The sport of the sports event.

@NonNull SportsTeam homeTeam

The home team of the sports event.

@NonNull SportsTeam awayTeam

The away team of the sports event.

Public methods

addAlternateName

Added in 1.2.0-alpha01
public @NonNulladdAlternateName(@NonNull String alternateName)

Adds an alias for the item.

addPotentialAction

Added in 1.2.0-alpha01
@ExperimentalAppSearchApi
public @NonNulladdPotentialAction(@NonNull PotentialAction newPotentialAction)

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

build

Added in 1.2.0-alpha01
public @NonNull SportsEvent build()

Builds a Thing object.

build

Added in 1.2.0-alpha01
public @NonNull Event build()

Builds a Thing object.

build

Added in 1.2.0-alpha01
public @NonNull Thing build()

Builds a Thing object.

clearAlternateNames

Added in 1.2.0-alpha01
public @NonNullclearAlternateNames()

Clears the aliases, if any, for the item.

clearPotentialActions

Added in 1.2.0-alpha01
@ExperimentalAppSearchApi
public @NonNullclearPotentialActions()

Clear all the potential actions for this document.

setAlternateNames

Added in 1.2.0-alpha01
public @NonNullsetAlternateNames(@Nullable List<String> alternateNames)

Sets a list of aliases for the item.

setAwayTeamAccessoryScore

Added in 1.2.0-alpha01
public @NonNullsetAwayTeamAccessoryScore(@Nullable String awayTeamAccessoryScore)

Sets the away team accessory score of the sports event. Format should be an additional contextual score that is used in some sports, e.g., like penalties in Soccer, overs in Cricket, etc.

setAwayTeamScore

Added in 1.2.0-alpha01
public @NonNullsetAwayTeamScore(@Nullable String awayTeamScore)

Sets the away team score of the sports event. Format should be a score of the away team, e.g., "100" for Basketball, "3" for American Baseball, etc.

setAwayTeamWinProbability

Added in 1.2.0-alpha01
public @NonNullsetAwayTeamWinProbability(double awayTeamWinProbability)

Sets the away team win probability of the sports event. Must be a range from 0 to 1.

setCreationTimestampMillis

Added in 1.2.0-alpha01
public @NonNullsetCreationTimestampMillis(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

Added in 1.2.0-alpha01
public @NonNullsetDescription(@Nullable String description)

Sets the description for the item.

setDocumentScore

Added in 1.2.0-alpha01
public @NonNullsetDocumentScore(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

Added in 1.2.0-alpha01
public @NonNullsetDocumentTtlMillis(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.

setDuration

Added in 1.2.0-alpha01
public @NonNullsetDuration(@Nullable Duration duration)

Sets the duration of the event as a Duration.

Parameters
@Nullable Duration duration

The duration of the event.

setEndDate

Added in 1.2.0-alpha01
public @NonNullsetEndDate(@Nullable Instant endDate)

Sets the end date of the event as a Instant.

Parameters
@Nullable Instant endDate

The end date of the event.

setGameTemporalState

Added in 1.2.0-alpha01
public @NonNullsetGameTemporalState(@Nullable String gameTemporalState)

Sets the game temporal state of the sports event. Format should be a temporal state of the game, e.g. "Quarter 1 - 10:00" for Basketball, "Halftime" for Soccer, "9th inning" for American Baseball, etc.

setHomeTeamAccessoryScore

Added in 1.2.0-alpha01
public @NonNullsetHomeTeamAccessoryScore(@Nullable String homeTeamAccessoryScore)

Sets the home team accessory score of the sports event. Format should be an additional contextual score that is used in some sports, e.g., like penalties in Soccer, overs in Cricket, etc.

setHomeTeamScore

Added in 1.2.0-alpha01
public @NonNullsetHomeTeamScore(@Nullable String homeTeamScore)

Sets the home team score of the sports event. Format should be a score of the home team, e.g., "100" for basketball, "3" for American Baseball, etc.

setHomeTeamWinProbability

Added in 1.2.0-alpha01
public @NonNullsetHomeTeamWinProbability(double homeTeamWinProbability)

Sets the home team win probability of the sports event. Must be a range from 0 to 1.

setImage

Added in 1.2.0-alpha01
@ExperimentalAppSearchApi
public @NonNullsetImage(@Nullable String image)

Sets the URL for an image of the item.

setLocation

Added in 1.2.0-alpha01
public @NonNullsetLocation(@Nullable String location)

Sets the location of the event. A freeform string describing the Event location. This could be a venue name, a string representation of a street address, or a string representation of a latitude/longitude pair. For example, "Some Place" or "123 Main Street, Anytown, CA" or "37.7749,-122.4194".

setLogo

Added in 1.2.0-alpha01
public @NonNullsetLogo(@Nullable ImageObject logo)

Sets the logo of the event.

setName

Added in 1.2.0-alpha01
public @NonNullsetName(@Nullable String name)

Sets the name of the item.

setNotableDetail

Added in 1.2.0-alpha01
public @NonNullsetNotableDetail(@Nullable String notableDetail)

Sets the most recent notable detail of the sports event. Format should be a most recent notable detail of the sports event, e.g. "2 outs, 2 balls, 1 strike" in American Baseball.

setOrganizer

Added in 1.2.0-alpha01
public @NonNullsetOrganizer(@Nullable Organization organizer)

Sets the Organization of the sports event.

setPlaceHomeTeamAtStart

Added in 1.2.0-alpha01
public @NonNullsetPlaceHomeTeamAtStart(boolean placeHomeTeamAtStart)

Sets whether the home team should be placed at the start for a visual representation of the sports event.

setPotentialActions

Added in 1.2.0-alpha01
@ExperimentalAppSearchApi
public @NonNullsetPotentialActions(@Nullable List<PotentialAction> newPotentialActions)

Sets a list of potential actions for this document.

setResult

Added in 1.2.0-alpha01
public @NonNullsetResult(long result)

Sets whether the home team won the sports event. During the course of the game, the value of this field should not be considered. The value of this field should only be set after the sports event has ended @{link SportsEventStatus.STATUS_COMPLETE} or has been cancelled @{link SportsEventStatus.STATUS_CANCELLED}, or any other terminal state.

setSportsEventStatus

Added in 1.2.0-alpha01
public @NonNullsetSportsEventStatus(long sportsEventStatus)

Sets the status of the sports event.

Parameters
long sportsEventStatus

the SportsEventStatus of the sports event.

setSportsEventStatusLabel

Added in 1.2.0-alpha01
public @NonNullsetSportsEventStatusLabel(@Nullable String sportsEventStatusLabel)

Sets the status label of the sports event.

Parameters
@Nullable String sportsEventStatusLabel

the status label of the sports event.

setUrl

Added in 1.2.0-alpha01
public @NonNullsetUrl(@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.