Trip.Builder
public final class Trip.Builder
A builder of Trip.
Summary
Public methods |
|
|---|---|
@NonNull Trip.Builder |
addDestination(Adds a destination to the trip. |
@NonNull Trip.Builder |
addStep(@NonNull Step step, @NonNull TravelEstimate stepTravelEstimate)Adds a step to the trip. |
@NonNull Trip |
build()Constructs the |
@NonNull Trip.Builder |
setCurrentRoad(@NonNull CharSequence currentRoad)Sets a description of the current road. |
@NonNull Trip.Builder |
setLoading(boolean isLoading)Sets whether the |
Public methods
addDestination
public @NonNull Trip.Builder addDestination(
@NonNull Destination destination,
@NonNull TravelEstimate destinationTravelEstimate
)
Adds a destination to the trip.
Destinations must be added in order of arrival. A destination is not required. Display surfaces may or may not use the destination and if multiple destinations are added the display may only show information about the first destination.
For every destination added, a corresponding TravelEstimate must be provided. Display surfaces may or may not use the destination travel estimate and if multiple destination travel estimates are added the display may only show information about the first destination travel estimate.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
addStep
public @NonNull Trip.Builder addStep(@NonNull Step step, @NonNull TravelEstimate stepTravelEstimate)
Adds a step to the trip.
Steps must be added in order of arrival. A step is not required. Display surfaces may or may not use the step and if multiple steps are added the display may only show information about the first step.
For every step added, a corresponding TravelEstimate must be provided. Display surfaces may or may not use the step travel estimate and if multiple step travel estimates are added the display may only show information about the first step travel estimate.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
setCurrentRoad
public @NonNull Trip.Builder setCurrentRoad(@NonNull CharSequence currentRoad)
Sets a description of the current road.
Spans are not supported in the input string and will be ignored.
| Throws | |
|---|---|
java.lang.NullPointerException |
if |
| See also | |
|---|---|
CarText |
setLoading
public @NonNull Trip.Builder setLoading(boolean isLoading)
Sets whether the Trip is in a loading state.
If set to true, the UI may show a loading indicator, and adding any steps or step travel estimates will throw an IllegalArgumentException.