Version.java
Go to the documentation of this file.
00001 /*
00002  *      Copyright (C) 2005-2015 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;
00022 
00023 import java.text.ParseException;
00024 import java.text.SimpleDateFormat;
00025 import java.util.Date;
00026 import java.util.Locale;
00027 
00033 public class Version {
00034 
00035         private final String hash;
00036         private final Date date;
00037         private final Branch branch;
00038         private final Type type;
00039 
00040         private static Version VERSION;
00041 
00046         public static Version get() {
00047                 if (VERSION == null) {
00048                         VERSION = new Version("72a7730", "2013-10-12 16:48:48 -0700", Branch.MASTER, Type.NIGHTLY);
00049                 }
00050                 return VERSION;
00051         }
00052 
00061         private Version(String hash, String date, Branch branch, Type type) {
00062                 final SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", Locale.US);
00063                 this.hash = hash;
00064                 try {
00065                         this.date = sfd.parse(date);
00066                 } catch (ParseException e) {
00067                         throw new IllegalArgumentException("Date must be in the form: yyyy-MM-dd HH:mm:ss Z (like: 2012-11-10 09:33:15 +0100).");
00068                 }
00069                 this.branch = branch;
00070                 this.type = type;
00071         }
00072 
00077         public String getHash() {
00078                 return hash;
00079         }
00080 
00085         public Date getDate() {
00086                 return date;
00087         }
00088 
00093         public Branch getBranch() {
00094                 return branch;
00095         }
00096 
00097         public Type getType() {
00098                 return type;
00099         }
00100 
00101         @Override
00102         public String toString() {
00103                 return hash + " (" + branch.toString().toLowerCase(Locale.US) + ")";
00104         }
00105 
00110         public enum Branch {
00111                 EDEN, FRODO, MASTER, UNKNOWN;
00112         }
00113 
00118         public enum Type {
00119                 SNAPSHOT, NIGHTLY, RELEASE, BETA, RC, UNKNOWN
00120         }
00121 }


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