Background.Builder


public final class Background.Builder


A builder of Background.

Summary

Public constructors

Returns an empty Builder instance.

Builder(@NonNull Background background)

Returns a new Builder with the data from the given Background instance.

Public methods

@NonNull Background

Constructs the Background defined by this builder.

@NonNull Background.Builder

Sets the CarColor to be used for the background.

@NonNull Background.Builder

Sets the CarIcon that will be displayed as the background.

Public constructors

Builder

Added in 1.8.0
public Builder()

Returns an empty Builder instance.

Builder

Added in 1.8.0
public Builder(@NonNull Background background)

Returns a new Builder with the data from the given Background instance.

Public methods

build

Added in 1.8.0
public @NonNull Background build()

Constructs the Background defined by this builder.

Ensures that exactly one of either an image or a color is set for the background.

Throws
java.lang.IllegalStateException

if neither an image nor a color is set, or if both an image and a color are set.

setColor

Added in 1.8.0
public @NonNull Background.Builder setColor(@NonNull CarColor color)

Sets the CarColor to be used for the background.

Throws
java.lang.NullPointerException

if color is null

setImage

Added in 1.8.0
public @NonNull Background.Builder setImage(@NonNull CarIcon image)

Sets the CarIcon that will be displayed as the background.

Throws
java.lang.NullPointerException

if image is null

java.lang.IllegalArgumentException

if image is not of type TYPE_CUSTOM