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

se.michaelthelin.spotify.model_objects.specification.ExternalId Maven / Gradle / Ivy

There is a newer version: 9.0.0-RC1
Show newest version
package se.michaelthelin.spotify.model_objects.specification;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import se.michaelthelin.spotify.model_objects.AbstractModelObject;

import java.util.Map;

/**
 * Retrieve information about
 * External ID objects
 * by building instances from this class.
 */
@JsonDeserialize(builder = ExternalId.Builder.class)
public class ExternalId extends AbstractModelObject {
  private final Map externalIds;

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

    this.externalIds = builder.externalIds;
  }

  /**
   * Get the external IDs from this 
   * External ID object. 

*

* External ID examples:
* "isrc" - * International Standard Recording Code
* "ean" - International Article Number *
* "upc" - Universal Product Code * * @return A {@link Map} of external IDs, containing external identifiers for the object. */ public Map getExternalIds() { return externalIds; } @Override public String toString() { return "ExternalId(externalIds=" + externalIds + ")"; } @Override public Builder builder() { return new Builder(); } /** * Builder class for building {@link ExternalId} instances. */ public static final class Builder extends AbstractModelObject.Builder { private Map externalIds; /** * External IDs setter. * * @param externalIds A {@link Map} of external IDs, containing external identifiers for the object. * @return A {@link ExternalId.Builder}. */ public Builder setExternalIds(Map externalIds) { this.externalIds = externalIds; return this; } @Override public ExternalId build() { return new ExternalId(this); } } /** * JsonUtil class for building {@link ExternalId} instances. */ @SuppressWarnings("unchecked") public static final class JsonUtil extends AbstractModelObject.JsonUtil { public ExternalId createModelObject(JsonObject jsonObject) { if (jsonObject == null || jsonObject.isJsonNull()) { return null; } Map map = new Gson().fromJson(jsonObject, Map.class); return new ExternalId.Builder() .setExternalIds(map) .build(); } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy