All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.wrapper.spotify.model_objects.special.FeaturedPlaylists Maven / Gradle / Ivy

package com.wrapper.spotify.model_objects.special;

import com.google.gson.JsonObject;
import com.wrapper.spotify.model_objects.AbstractModelObject;
import com.wrapper.spotify.model_objects.specification.Paging;
import com.wrapper.spotify.model_objects.specification.PlaylistSimplified;

/**
 * Retrieve information about 
 * Featured Playlist objects by building instances from this class.
 */
public class FeaturedPlaylists extends AbstractModelObject {
  private final String message;
  private final Paging playlists;

  private FeaturedPlaylists(final Builder builder) {
    super(builder);

    this.message = builder.message;
    this.playlists = builder.playlists;
  }

  /**
   * Get the message which is displayed on the front page of the "browse" tab in the Spotify client. 
* The message usually refers to the featured playlists. * * @return A "welcoming" message. */ public String getMessage() { return message; } /** * Get the page of featured playlists. * * @return Featured playlists page. */ public Paging getPlaylists() { return playlists; } @Override public Builder builder() { return new Builder(); } /** * Builder class for building {@link FeaturedPlaylists} instances. */ public static final class Builder extends AbstractModelObject.Builder { private String message; private Paging playlists; /** * Set the message, which normally would be displayed on the front page of the "browse" tab. * * @param message Message to be set. * @return A {@link FeaturedPlaylists.Builder}. */ public Builder setMessage(String message) { this.message = message; return this; } /** * Set a page of playlists contained in the featured playlists object to be built. * * @param playlists A page of simplified playlists. * @return A {@link FeaturedPlaylists.Builder}. */ public Builder setPlaylists(Paging playlists) { this.playlists = playlists; return this; } @Override public FeaturedPlaylists build() { return new FeaturedPlaylists(this); } } /** * JsonUtil class for building {@link FeaturedPlaylists} instances. */ public static final class JsonUtil extends AbstractModelObject.JsonUtil { public FeaturedPlaylists createModelObject(JsonObject jsonObject) { if (jsonObject == null || jsonObject.isJsonNull()) { return null; } return new FeaturedPlaylists.Builder() .setMessage( hasAndNotNull(jsonObject, "message") ? jsonObject.get("message").getAsString() : null) .setPlaylists( hasAndNotNull(jsonObject, "playlists") ? new PlaylistSimplified.JsonUtil().createModelObjectPaging( jsonObject.getAsJsonObject("playlists")) : null) .build(); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy