facebook4j.internal.util
Class z_F4JInternalParseUtil

java.lang.Object
  extended by facebook4j.internal.util.z_F4JInternalParseUtil

public final class z_F4JInternalParseUtil
extends Object

A tiny parse utility class.

Author:
Yusuke Yamamoto - yusuke at mac.com, Ryuji Yamashita - roundrop at gmail.com

Method Summary
static int computeTimeZoneOffsetInHours(TimeZone timeZone, long currentDatetime)
          Computes the offset in hours for a given timezone at a given date/time.
static Boolean getBoolean(String name, JSONObject json)
           
static Map<String,Boolean> getBooleanMap(String name, JSONObject json)
           
static Double getDouble(String name, JSONObject json)
           
static boolean getFlag(String name, JSONObject json)
           
static Integer getInt(String str)
           
static Integer getInt(String name, JSONObject json)
           
static Date getISO8601Datetime(String name, JSONObject json)
           
static Long getLong(String str)
           
static Long getLong(String name, JSONObject json)
           
static Map<String,Long> getLongMap(String name, JSONObject json)
           
static int getPrimitiveInt(String str)
           
static int getPrimitiveInt(String name, JSONObject json)
           
static long getPrimitiveLong(String str)
           
static long getPrimitiveLong(String name, JSONObject json)
           
static String getRawString(String name, JSONObject json)
           
static List<String> getStringList(String name, JSONObject json)
           
static Map<String,String> getStringMap(String name, JSONObject json)
           
static TimeZone getTimeZone(String name, JSONObject json)
           
static Double getTimeZoneOffset(String name, JSONObject json, long datetimeReference)
          Parses the value of a field as a timezone offset in hours.
static URI getURI(String name, JSONObject json)
           
static URL getURL(String name, JSONObject json)
           
static boolean isJSONArray(String name, JSONObject json)
           
static boolean isJSONObject(String name, JSONObject json)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getRawString

public static String getRawString(String name,
                                  JSONObject json)

getPrimitiveInt

public static int getPrimitiveInt(String name,
                                  JSONObject json)

getPrimitiveInt

public static int getPrimitiveInt(String str)

getInt

public static Integer getInt(String name,
                             JSONObject json)

getInt

public static Integer getInt(String str)

getPrimitiveLong

public static long getPrimitiveLong(String name,
                                    JSONObject json)

getPrimitiveLong

public static long getPrimitiveLong(String str)

getLong

public static Long getLong(String name,
                           JSONObject json)

getLong

public static Long getLong(String str)

getDouble

public static Double getDouble(String name,
                               JSONObject json)

getTimeZoneOffset

public static Double getTimeZoneOffset(String name,
                                       JSONObject json,
                                       long datetimeReference)
Parses the value of a field as a timezone offset in hours. A timezone offset is the value added to UTC time to get the user's local time. A date/time reference point must be provided because the offset may differ based on the date/time for which it is to be computed, for example because of daylight savings.

Parameters:
name - the name of the member of the given json object that is the raw string to be parsed
json - the json object
datetimeReference - the date/time for which the offset is to be computed
Returns:
the timezone offset, in hours

computeTimeZoneOffsetInHours

public static int computeTimeZoneOffsetInHours(TimeZone timeZone,
                                               long currentDatetime)
Computes the offset in hours for a given timezone at a given date/time.

Parameters:
timeZone - the timezone
currentDatetime - the date/time
Returns:
the offset, in hours

getBoolean

public static Boolean getBoolean(String name,
                                 JSONObject json)

getFlag

public static boolean getFlag(String name,
                              JSONObject json)

getISO8601Datetime

public static Date getISO8601Datetime(String name,
                                      JSONObject json)
                               throws FacebookException
Throws:
FacebookException

getURL

public static URL getURL(String name,
                         JSONObject json)

getURI

public static URI getURI(String name,
                         JSONObject json)

getTimeZone

public static TimeZone getTimeZone(String name,
                                   JSONObject json)

getStringMap

public static Map<String,String> getStringMap(String name,
                                              JSONObject json)
                                       throws FacebookException
Throws:
FacebookException

getLongMap

public static Map<String,Long> getLongMap(String name,
                                          JSONObject json)
                                   throws FacebookException
Throws:
FacebookException

getBooleanMap

public static Map<String,Boolean> getBooleanMap(String name,
                                                JSONObject json)
                                         throws FacebookException
Throws:
FacebookException

getStringList

public static List<String> getStringList(String name,
                                         JSONObject json)
                                  throws FacebookException
Throws:
FacebookException

isJSONObject

public static boolean isJSONObject(String name,
                                   JSONObject json)

isJSONArray

public static boolean isJSONArray(String name,
                                  JSONObject json)


Copyright © 2019. All rights reserved.