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

public static final class Track.Builder extends AbstractModelObject.Builder
Builder class for building Track instances.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • setAlbum

      public Track.Builder setAlbum(AlbumSimplified album)
      Set the album of the track to be built.
      Parameters:
      album - The album on which the track appears.
      Returns:
      A Track.Builder.
    • setArtists

      public Track.Builder setArtists(ArtistSimplified... artists)
      Set the artists of the track to be built.
      Parameters:
      artists - The artists who performed the track.
      Returns:
      A Track.Builder.
    • setAvailableMarkets

      public Track.Builder setAvailableMarkets(com.neovisionaries.i18n.CountryCode... availableMarkets)
      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

      public Track.Builder setDiscNumber(Integer discNumber)
      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

      public Track.Builder setDurationMs(Integer durationMs)
      Set the duration in milliseconds of the track to be built.
      Parameters:
      durationMs - The track length in milliseconds.
      Returns:
      A Track.Builder.
    • setExplicit

      public Track.Builder setExplicit(Boolean explicit)
      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

      public Track.Builder setExternalIds(ExternalId externalIds)
      Set the external IDs of the track to be built.
      Parameters:
      externalIds - Known external IDs for the track.
      Returns:
      A Track.Builder.
    • setExternalUrls

      public Track.Builder setExternalUrls(ExternalUrl externalUrls)
      Set external URLs of the track to be built.
      Parameters:
      externalUrls - Known external URLs for the track.
      Returns:
      A Track.Builder.
    • setHref

      public Track.Builder setHref(String href)
      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

      public Track.Builder setId(String id)
      Set track ID of the track to be built.
      Parameters:
      id - The Spotify ID for the track.
      Returns:
      A Track.Builder.
    • setIsPlayable

      public Track.Builder setIsPlayable(Boolean isPlayable)
      Set whether the track to be built is playable in your market region or not.
      Parameters:
      isPlayable - If true, the track is playable in the given market. Otherwise false.
      Returns:
      A Track.Builder.
    • setLinkedFrom

      public Track.Builder setLinkedFrom(TrackLink linkedFrom)
      Set the track link object of the track to be built.
      Parameters:
      linkedFrom - The track in the linked_from object contains information about the originally requested track.
      Returns:
      A Track.Builder.
    • setRestrictions

      public Track.Builder setRestrictions(Restrictions restrictions)
      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

      public Track.Builder setName(String name)
      Set the name of the track to be built.
      Parameters:
      name - Track name.
      Returns:
      A Track.Builder.
    • setPopularity

      public Track.Builder setPopularity(Integer popularity)
      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

      public Track.Builder setPreviewUrl(String previewUrl)
      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

      public Track.Builder setTrackNumber(Integer trackNumber)
      Set the track number of the track to be built.
      Parameters:
      trackNumber - The track number.
      Returns:
      A Track.Builder.
    • setType

      public Track.Builder setType(ModelObjectType type)
      Set the type of the model object. In this case "track".
      Parameters:
      type - The object type: "track".
      Returns:
      A Track.Builder.
    • setUri

      public Track.Builder setUri(String uri)
      Set Spotify URI of the track to be built.
      Parameters:
      uri - The Spotify URI for the track.
      Returns:
      A Track.Builder.
    • build

      public Track 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.