LibraryModel.java
Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2005-2013 Team XBMC
00003  *      http://xbmc.org
00004  *
00005  *  This Program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2, or (at your option)
00008  *  any later version.
00009  *
00010  *  This Program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with XBMC Remote; see the file license.  If not, write to
00017  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00018  *  http://www.gnu.org/copyleft/gpl.html
00019  *
00020  */
00021 package org.xbmc.android.jsonrpc.api.model;
00022 
00023 import android.os.Parcel;
00024 import android.os.Parcelable;
00025 import java.util.ArrayList;
00026 import java.util.Arrays;
00027 import java.util.HashSet;
00028 import java.util.List;
00029 import java.util.Set;
00030 import org.codehaus.jackson.JsonNode;
00031 import org.codehaus.jackson.node.ArrayNode;
00032 import org.codehaus.jackson.node.ObjectNode;
00033 
00034 public final class LibraryModel {
00035 
00042         public static class GenreDetail extends ItemModel.BaseDetail {
00043                 public final static String API_TYPE = "Library.Details.Genre";
00044 
00045                 // field names
00046                 public static final String GENREID = "genreid";
00047                 public static final String THUMBNAIL = "thumbnail";
00048                 public static final String TITLE = "title";
00049 
00050                 // class members
00051                 public final Integer genreid;
00052                 public final String thumbnail;
00053                 public final String title;
00054 
00059                 public GenreDetail(JsonNode node) {
00060                         super(node);
00061                         genreid = parseInt(node, GENREID);
00062                         thumbnail = parseString(node, THUMBNAIL);
00063                         title = parseString(node, TITLE);
00064                 }
00065 
00066                 @Override
00067                 public JsonNode toJsonNode() {
00068                         final ObjectNode node = (ObjectNode)super.toJsonNode();
00069                         node.put(GENREID, genreid);
00070                         node.put(THUMBNAIL, thumbnail);
00071                         node.put(TITLE, title);
00072                         return node;
00073                 }
00074 
00080                 static List<GenreDetail> getLibraryModelGenreDetailList(JsonNode node, String key) {
00081                         if (node.has(key)) {
00082                                 final ArrayNode a = (ArrayNode)node.get(key);
00083                                 final List<GenreDetail> l = new ArrayList<GenreDetail>(a.size());
00084                                 for (int i = 0; i < a.size(); i++) {
00085                                         l.add(new GenreDetail((JsonNode)a.get(i)));
00086                                 }
00087                                 return l;
00088                         }
00089                         return new ArrayList<GenreDetail>(0);
00090                 }
00091 
00097                 @Override
00098                 public void writeToParcel(Parcel parcel, int flags) {
00099                         super.writeToParcel(parcel, flags);
00100                         parcel.writeValue(genreid);
00101                         parcel.writeValue(thumbnail);
00102                         parcel.writeValue(title);
00103                 }
00104 
00108                 protected GenreDetail(Parcel parcel) {
00109                         super(parcel);
00110                         genreid = parcel.readInt();
00111                         thumbnail = parcel.readString();
00112                         title = parcel.readString();
00113                 }
00114 
00118                 public static final Parcelable.Creator<GenreDetail> CREATOR = new Parcelable.Creator<GenreDetail>() {
00119                         @Override
00120                         public GenreDetail createFromParcel(Parcel parcel) {
00121                                 return new GenreDetail(parcel);
00122                         }
00123                         @Override
00124                         public GenreDetail[] newArray(int n) {
00125                                 return new GenreDetail[n];
00126                         }
00127                 };
00128 
00129                 @Override
00130                 public int describeContents() {
00131                         return 0;
00132                 }
00133         }
00134 
00138         public interface GenreFields {
00139 
00140                 public final String TITLE = "title";
00141                 public final String THUMBNAIL = "thumbnail";
00142 
00143                 public final static Set<String> values = new HashSet<String>(Arrays.asList(TITLE, THUMBNAIL));
00144         }
00145 }


smarthome_media_kodi_driver
Author(s): Mickael Gaillard , Erwan Le Huitouze
autogenerated on Thu Jun 6 2019 21:03:49