public class BaseJsonExtensions
extends java.lang.Object
Constructor and Description |
---|
BaseJsonExtensions() |
Modifier and Type | Method and Description |
---|---|
protected java.text.SimpleDateFormat |
dateFormatter()
Get a date formatter configured for the SocialIdApi format of date.
|
protected java.text.SimpleDateFormat |
datetimeFormatter()
Get a date formatter configured for the SocialIdApi format of datetime.
|
protected <C> java.util.Collection<C> |
optCollection(java.util.Collection<C> collection,
org.json.JSONObject jsonObject,
java.lang.String key,
com.coffeebeantech.socialidapi.util.BaseJsonExtensions.JSONArrayOptGetter<C> getter)
Get an optional parametrized collection associated with a key.
|
protected java.util.Date |
optDate(org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional date associated with a key.
|
protected java.util.Date |
optDateTime(org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional datetime associated with a key.
|
protected java.util.Collection<java.lang.Integer> |
optIntegerCollection(java.util.Collection<java.lang.Integer> integerCollection,
org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional integer collection associated with a key.
|
protected java.util.List<java.lang.Integer> |
optIntegerList(org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional integer list associated with a key.
|
protected java.util.Set<java.lang.Integer> |
optIntegerSet(org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional integer set associated with a key.
|
protected java.lang.String |
optString(org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional string associated with a key.
|
protected java.util.Collection<java.lang.String> |
optStringCollection(java.util.Collection<java.lang.String> stringCollection,
org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional string collection associated with a key.
|
protected java.util.List<java.lang.String> |
optStringList(org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional string list associated with a key.
|
protected java.util.Set<java.lang.String> |
optStringSet(org.json.JSONObject jsonObject,
java.lang.String key)
Get an optional string set associated with a key.
|
protected java.util.List<java.lang.String> optStringList(org.json.JSONObject jsonObject, java.lang.String key)
jsonObject
- The object to get the string list fromkey
- A key stringprotected java.util.Set<java.lang.String> optStringSet(org.json.JSONObject jsonObject, java.lang.String key)
jsonObject
- The object to get the string set fromkey
- A key stringprotected java.util.Collection<java.lang.String> optStringCollection(java.util.Collection<java.lang.String> stringCollection, org.json.JSONObject jsonObject, java.lang.String key)
stringCollection
- The collection already initializedjsonObject
- The object to get the string collection fromkey
- A key stringprotected java.util.List<java.lang.Integer> optIntegerList(org.json.JSONObject jsonObject, java.lang.String key)
jsonObject
- The object to get the integer list fromkey
- A key stringprotected java.util.Set<java.lang.Integer> optIntegerSet(org.json.JSONObject jsonObject, java.lang.String key)
jsonObject
- The object to get the integer set fromkey
- A key stringprotected java.util.Collection<java.lang.Integer> optIntegerCollection(java.util.Collection<java.lang.Integer> integerCollection, org.json.JSONObject jsonObject, java.lang.String key)
integerCollection
- The collection already initializedjsonObject
- The object to get the integer collection fromkey
- A key stringprotected <C> java.util.Collection<C> optCollection(java.util.Collection<C> collection, org.json.JSONObject jsonObject, java.lang.String key, com.coffeebeantech.socialidapi.util.BaseJsonExtensions.JSONArrayOptGetter<C> getter)
collection
- The collection already initializedjsonObject
- The object to get the collection fromkey
- A key stringprotected java.lang.String optString(org.json.JSONObject jsonObject, java.lang.String key)
jsonObject
- The object to get the date fromkey
- A key string.protected java.util.Date optDate(org.json.JSONObject jsonObject, java.lang.String key)
jsonObject
- The object to get the date fromkey
- A key string.protected java.util.Date optDateTime(org.json.JSONObject jsonObject, java.lang.String key)
jsonObject
- The object to get the datetime fromkey
- A key string.protected java.text.SimpleDateFormat dateFormatter()
protected java.text.SimpleDateFormat datetimeFormatter()