public class JsonParseUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.joda.time.format.DateTimeFormatter |
JIRA_DATE_FORMATTER |
static org.joda.time.format.DateTimeFormatter |
JIRA_DATE_TIME_FORMATTER |
static String |
JIRA_DATE_TIME_PATTERN |
static String |
SELF_ATTR |
| Constructor and Description |
|---|
JsonParseUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
formatDate(org.joda.time.DateTime dateTime) |
static String |
formatDateTime(org.joda.time.DateTime dateTime) |
static Map<String,URI> |
getAvatarUris(org.codehaus.jettison.json.JSONObject jsonObject) |
static org.codehaus.jettison.json.JSONArray |
getNestedArray(org.codehaus.jettison.json.JSONObject json,
String... path) |
static boolean |
getNestedBoolean(org.codehaus.jettison.json.JSONObject json,
String... path) |
static org.codehaus.jettison.json.JSONObject |
getNestedObject(org.codehaus.jettison.json.JSONObject json,
String... path) |
static org.codehaus.jettison.json.JSONArray |
getNestedOptionalArray(org.codehaus.jettison.json.JSONObject json,
String... path) |
static org.codehaus.jettison.json.JSONObject |
getNestedOptionalObject(org.codehaus.jettison.json.JSONObject json,
String... path) |
static String |
getNestedString(org.codehaus.jettison.json.JSONObject json,
String... path) |
static String |
getNullableString(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static com.google.common.base.Optional<org.codehaus.jettison.json.JSONArray> |
getOptionalArray(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static org.codehaus.jettison.json.JSONObject |
getOptionalJsonObject(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static <T> T |
getOptionalJsonObject(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName,
JsonObjectParser<T> jsonParser) |
static Long |
getOptionalLong(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static String |
getOptionalString(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static URI |
getSelfUri(org.codehaus.jettison.json.JSONObject jsonObject) |
static Iterator<String> |
getStringKeys(org.codehaus.jettison.json.JSONObject json) |
static URI |
optSelfUri(org.codehaus.jettison.json.JSONObject jsonObject,
URI defaultUri) |
static BasicUser |
parseBasicUser(org.codehaus.jettison.json.JSONObject json) |
static org.joda.time.DateTime |
parseDate(String str) |
static org.joda.time.DateTime |
parseDateTime(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static org.joda.time.DateTime |
parseDateTime(String str) |
static org.joda.time.DateTime |
parseDateTimeOrDate(String str)
Tries to parse date and time and return that.
|
static <T> ExpandableProperty<T> |
parseExpandableProperty(org.codehaus.jettison.json.JSONObject json,
JsonObjectParser<T> expandablePropertyBuilder) |
static <T> Collection<T> |
parseJsonArray(org.codehaus.jettison.json.JSONArray jsonArray,
JsonObjectParser<T> jsonParser) |
static org.joda.time.DateTime |
parseOptionalDateTime(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static <T> ExpandableProperty<T> |
parseOptionalExpandableProperty(org.codehaus.jettison.json.JSONObject json,
JsonObjectParser<T> expandablePropertyBuilder) |
static <T> OptionalIterable<T> |
parseOptionalJsonArray(org.codehaus.jettison.json.JSONArray jsonArray,
JsonObjectParser<T> jsonParser) |
static <T> T |
parseOptionalJsonObject(org.codehaus.jettison.json.JSONObject json,
String attributeName,
JsonObjectParser<T> jsonParser) |
static URI |
parseOptionalURI(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName) |
static Integer |
parseOptionInteger(org.codehaus.jettison.json.JSONObject json,
String attributeName) |
static URI |
parseURI(String str) |
static Collection<String> |
toStringCollection(org.codehaus.jettison.json.JSONArray jsonArray) |
static Map<String,String> |
toStringMap(org.codehaus.jettison.json.JSONArray names,
org.codehaus.jettison.json.JSONObject values) |
public static final String JIRA_DATE_TIME_PATTERN
public static final org.joda.time.format.DateTimeFormatter JIRA_DATE_TIME_FORMATTER
public static final org.joda.time.format.DateTimeFormatter JIRA_DATE_FORMATTER
public static final String SELF_ATTR
public static <T> Collection<T> parseJsonArray(org.codehaus.jettison.json.JSONArray jsonArray, JsonObjectParser<T> jsonParser) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static <T> OptionalIterable<T> parseOptionalJsonArray(org.codehaus.jettison.json.JSONArray jsonArray, JsonObjectParser<T> jsonParser) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static <T> T parseOptionalJsonObject(org.codehaus.jettison.json.JSONObject json,
String attributeName,
JsonObjectParser<T> jsonParser)
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static <T> ExpandableProperty<T> parseExpandableProperty(org.codehaus.jettison.json.JSONObject json, JsonObjectParser<T> expandablePropertyBuilder) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException@Nullable public static <T> ExpandableProperty<T> parseOptionalExpandableProperty(@Nullable org.codehaus.jettison.json.JSONObject json, JsonObjectParser<T> expandablePropertyBuilder) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static URI getSelfUri(org.codehaus.jettison.json.JSONObject jsonObject) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static URI optSelfUri(org.codehaus.jettison.json.JSONObject jsonObject, URI defaultUri) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static org.codehaus.jettison.json.JSONObject getNestedObject(org.codehaus.jettison.json.JSONObject json,
String... path)
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException@Nullable public static org.codehaus.jettison.json.JSONObject getNestedOptionalObject(org.codehaus.jettison.json.JSONObject json, String... path) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static org.codehaus.jettison.json.JSONArray getNestedArray(org.codehaus.jettison.json.JSONObject json,
String... path)
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static org.codehaus.jettison.json.JSONArray getNestedOptionalArray(org.codehaus.jettison.json.JSONObject json,
String... path)
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static String getNestedString(org.codehaus.jettison.json.JSONObject json, String... path) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static boolean getNestedBoolean(org.codehaus.jettison.json.JSONObject json,
String... path)
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException@Nullable public static URI parseOptionalURI(org.codehaus.jettison.json.JSONObject jsonObject, String attributeName)
@Nullable public static BasicUser parseBasicUser(@Nullable org.codehaus.jettison.json.JSONObject json) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static org.joda.time.DateTime parseDateTime(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName)
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException@Nullable public static org.joda.time.DateTime parseOptionalDateTime(org.codehaus.jettison.json.JSONObject jsonObject, String attributeName) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static org.joda.time.DateTime parseDateTime(String str)
public static org.joda.time.DateTime parseDateTimeOrDate(String str)
str - String contains either date and time or date onlypublic static org.joda.time.DateTime parseDate(String str)
public static String formatDate(org.joda.time.DateTime dateTime)
public static String formatDateTime(org.joda.time.DateTime dateTime)
@Nullable public static String getNullableString(org.codehaus.jettison.json.JSONObject jsonObject, String attributeName) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException@Nullable public static String getOptionalString(org.codehaus.jettison.json.JSONObject jsonObject, String attributeName)
@Nullable public static <T> T getOptionalJsonObject(org.codehaus.jettison.json.JSONObject jsonObject, String attributeName, JsonObjectParser<T> jsonParser) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException@Nullable public static org.codehaus.jettison.json.JSONObject getOptionalJsonObject(org.codehaus.jettison.json.JSONObject jsonObject, String attributeName)
public static Collection<String> toStringCollection(org.codehaus.jettison.json.JSONArray jsonArray) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static Integer parseOptionInteger(org.codehaus.jettison.json.JSONObject json, String attributeName) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONException@Nullable public static Long getOptionalLong(org.codehaus.jettison.json.JSONObject jsonObject, String attributeName) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static com.google.common.base.Optional<org.codehaus.jettison.json.JSONArray> getOptionalArray(org.codehaus.jettison.json.JSONObject jsonObject,
String attributeName)
throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static Map<String,URI> getAvatarUris(org.codehaus.jettison.json.JSONObject jsonObject) throws org.codehaus.jettison.json.JSONException
org.codehaus.jettison.json.JSONExceptionpublic static Iterator<String> getStringKeys(org.codehaus.jettison.json.JSONObject json)
Copyright © 2016 Atlassian. All rights reserved.