![JAR search and dependency download from the Maven repository](/logo.png)
net.jeremybrooks.jinx.response.blogs.BlogServices Maven / Gradle / Ivy
/*
* Jinx is Copyright 2010-2020 by Jeremy Brooks and Contributors
*
* Jinx is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Jinx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jinx. If not, see .
*/
package net.jeremybrooks.jinx.response.blogs;
import com.google.gson.annotations.SerializedName;
import net.jeremybrooks.jinx.response.Response;
import java.io.Serializable;
import java.util.List;
/**
* Response from the Flickr blogs.getServices API request.
*
* @author Jeremy Brooks
*/
public class BlogServices extends Response {
private static final long serialVersionUID = 5614928721323005674L;
private _Services services;
/**
* Get the list of services.
*
* @return list of services, or null if nothing was found.
*/
public List getServiceList() {
return services.service == null ? null : services.service;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("classname=").append(this.getClass().getName());
sb.append(",services=[");
for (Service service : this.getServiceList()) {
sb.append(service.toString());
}
sb.append("],");
sb.append(super.toString());
return sb.toString();
}
private class _Services implements Serializable {
private static final long serialVersionUID = -807297732670615243L;
private List service;
}
/**
* Represents a blogging service.
* Each service has an ID and a Name.
*/
public class Service implements Serializable {
private static final long serialVersionUID = -8940134672269171031L;
private String id;
@SerializedName("_content")
private String name;
/**
* Get the ID of the service.
* @return id of the service.
*/
public String getId() {
return id;
}
/**
* Get the name of the service.
* Note: this field is called "_content" in the response document. We call it name here.
* @return name of the service.
*/
public String getName() {
return name;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("{id=\"").append(id).append('\"');
sb.append(",name=\"").append(name).append('\"').append('}');
return sb.toString();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy