
org.tinymediamanager.jsonrpc.api.model.GlobalModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kodi-json-rpc Show documentation
Show all versions of kodi-json-rpc Show documentation
This library is the result of freezy's Kodi JSON introspection, merged with dereulenspiegel's adoption
without android, and patched to Kodi 16 Jarvis.
The newest version!
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program 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 2, or (at your option)
* any later version.
*
* This Program 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 XBMC Remote; see the file license. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
package org.tinymediamanager.jsonrpc.api.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.codehaus.jackson.JsonNode;
import org.codehaus.jackson.node.ArrayNode;
import org.codehaus.jackson.node.BooleanNode;
import org.codehaus.jackson.node.ObjectNode;
import org.codehaus.jackson.node.TextNode;
import org.tinymediamanager.jsonrpc.api.AbstractModel;
public final class GlobalModel {
/**
* API Name: Global.Time
*
* Note: This class is used as result only.
* This class was generated automatically from XBMC's JSON-RPC introspect.
*/
public static class Time extends AbstractModel {
public final static String API_TYPE = "Global.Time";
// field names
public static final String HOURS = "hours";
public static final String MILLISECONDS = "milliseconds";
public static final String MINUTES = "minutes";
public static final String SECONDS = "seconds";
// class members
public final Integer hours;
public final Integer milliseconds;
public final Integer minutes;
public final Integer seconds;
/**
* @param hours
* @param milliseconds
* @param minutes
* @param seconds
*/
public Time(Integer hours, Integer milliseconds, Integer minutes, Integer seconds) {
this.hours = hours;
this.milliseconds = milliseconds;
this.minutes = minutes;
this.seconds = seconds;
}
/**
* Returns the time in milliseconds
*
* @return
*/
public long getMilliseconds() {
return hours * 3600000 + minutes * 60000 + seconds * 1000 + milliseconds;
}
/**
* Construct from JSON object.
*
* @param node
* JSON object representing a Time object
*/
public Time(JsonNode node) {
hours = node.get(HOURS).getIntValue(); // required value
milliseconds = node.get(MILLISECONDS).getIntValue(); // required value
minutes = node.get(MINUTES).getIntValue(); // required value
seconds = node.get(SECONDS).getIntValue(); // required value
}
@Override
public JsonNode toJsonNode() {
final ObjectNode node = OM.createObjectNode();
node.put(HOURS, hours);
node.put(MILLISECONDS, milliseconds);
node.put(MINUTES, minutes);
node.put(SECONDS, seconds);
return node;
}
/**
* Extracts a list of {@link Time} objects from a JSON array.
*
* @param node
* ObjectNode containing the list of objects.
* @param key
* Key pointing to the node where the list is stored.
*/
static List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy