Class Track.Builder
java.lang.Object
se.michaelthelin.spotify.model_objects.AbstractModelObject.Builder
se.michaelthelin.spotify.model_objects.specification.Track.Builder
- All Implemented Interfaces:
IModelObject.Builder
- Enclosing class:
Track
Builder class for building
Track
instances.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build a model object with the information set in the builder object.setAlbum
(AlbumSimplified album) Set the album of the track to be built.setArtists
(ArtistSimplified... artists) Set the artists of the track to be built.setAvailableMarkets
(com.neovisionaries.i18n.CountryCode... availableMarkets) Set the available markets of the track to be built.setDiscNumber
(Integer discNumber) Set the disc number of the track to be built.setDurationMs
(Integer durationMs) Set the duration in milliseconds of the track to be built.setExplicit
(Boolean explicit) Set whether the track to be built is explicit or not.setExternalIds
(ExternalId externalIds) Set the external IDs of the track to be built.setExternalUrls
(ExternalUrl externalUrls) Set external URLs of the track to be built.Set href of Spotify Web API endpoint of the track to be built.Set track ID of the track to be built.setIsPlayable
(Boolean isPlayable) Set whether the track to be built is playable in your market region or not.setLinkedFrom
(TrackLink linkedFrom) Set the track link object of the track to be built.Set the name of the track to be built.setPopularity
(Integer popularity) Set the popularity of the track to be built.setPreviewUrl
(String previewUrl) Set the preview URL of the track to be built.setRestrictions
(Restrictions restrictions) Set the restrictions object of the track to be built.setTrackNumber
(Integer trackNumber) Set the track number of the track to be built.setType
(ModelObjectType type) Set the type of the model object.Set Spotify URI of the track to be built.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setAlbum
Set the album of the track to be built.- Parameters:
album
- The album on which the track appears.- Returns:
- A
Track.Builder
.
-
setArtists
Set the artists of the track to be built.- Parameters:
artists
- The artists who performed the track.- Returns:
- A
Track.Builder
.
-
setAvailableMarkets
Set the available markets of the track to be built.- Parameters:
availableMarkets
- A list of the countries in which the track can be played, identified by their ISO 3166-1 alpha-2 code.- Returns:
- A
Track.Builder
.
-
setDiscNumber
Set the disc number of the track to be built.- Parameters:
discNumber
- The disc number (usually 1 unless the album consists of more than one disc).- Returns:
- A
Track.Builder
.
-
setDurationMs
Set the duration in milliseconds of the track to be built.- Parameters:
durationMs
- The track length in milliseconds.- Returns:
- A
Track.Builder
.
-
setExplicit
Set whether the track to be built is explicit or not.- Parameters:
explicit
- Whether or not the track has explicit lyrics (true
= yes it does;false
= no it does not OR unknown).- Returns:
- A
Track.Builder
.
-
setExternalIds
Set the external IDs of the track to be built.- Parameters:
externalIds
- Known external IDs for the track.- Returns:
- A
Track.Builder
.
-
setExternalUrls
Set external URLs of the track to be built.- Parameters:
externalUrls
- Known external URLs for the track.- Returns:
- A
Track.Builder
.
-
setHref
Set href of Spotify Web API endpoint of the track to be built.- Parameters:
href
- A link to the Web API endpoint providing full details of the track.- Returns:
- A
Track.Builder
.
-
setId
Set track ID of the track to be built.- Parameters:
id
- The Spotify ID for the track.- Returns:
- A
Track.Builder
.
-
setIsPlayable
Set whether the track to be built is playable in your market region or not.- Parameters:
isPlayable
- Iftrue
, the track is playable in the given market. Otherwisefalse
.- Returns:
- A
Track.Builder
.
-
setLinkedFrom
Set the track link object of the track to be built.- Parameters:
linkedFrom
- The track in thelinked_from
object contains information about the originally requested track.- Returns:
- A
Track.Builder
.
-
setRestrictions
Set the restrictions object of the track to be built.- Parameters:
restrictions
- The track response will still contain metadata for the original track, and a restrictions object containing the reason why the track is not available.- Returns:
- A
Track.Builder
.
-
setName
Set the name of the track to be built.- Parameters:
name
- Track name.- Returns:
- A
Track.Builder
.
-
setPopularity
Set the popularity of the track to be built.- Parameters:
popularity
- The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.- Returns:
- A
Track.Builder
.
-
setPreviewUrl
Set the preview URL of the track to be built.- Parameters:
previewUrl
- A link to a 30 second preview (MP3 format) of the track.null
if not available.- Returns:
- A
Track.Builder
.
-
setTrackNumber
Set the track number of the track to be built.- Parameters:
trackNumber
- The track number.- Returns:
- A
Track.Builder
.
-
setType
Set the type of the model object. In this case "track".- Parameters:
type
- The object type: "track".- Returns:
- A
Track.Builder
.
-
setUri
Set Spotify URI of the track to be built.- Parameters:
uri
- The Spotify URI for the track.- Returns:
- A
Track.Builder
.
-
build
Description copied from interface:IModelObject.Builder
Build a model object with the information set in the builder object.
The type of the model object and its methods depend on its corresponding implementation.- Returns:
- A model object.
-