com.atlassian.jira.issue.fields.rest.json
Class JsonData
java.lang.Object
com.atlassian.jira.issue.fields.rest.json.JsonData
@PublicApi
public class JsonData
- extends Object
- Since:
- 5.0 TODO THIS CLASS IS IN PROGRESS, see JRADEV-7098 and JRADEV-7099
Method Summary |
List<?> |
asArray()
|
List<String> |
asArrayOfObjectsWithId(String fieldName,
ErrorCollection errors)
|
List<String> |
asArrayOfObjectsWithProperty(String propertyname,
String fieldName,
ErrorCollection errors)
|
List<String> |
asArrayOfStrings(boolean allowNulls,
String fieldName,
ErrorCollection errors)
|
Map<String,Object> |
asObject()
|
String |
asObjectWithProperty(String propertyname,
String fieldName,
boolean expected,
ErrorCollection errors)
|
String |
asObjectWithProperty(String propertyname,
String fieldName,
ErrorCollection errors)
|
String |
asString()
|
String |
asString(String fieldName,
ErrorCollection errors)
|
|
convertValue(String propertyname,
Class<T> type,
ErrorCollection errors)
|
|
convertValue(String fieldId,
TypeRef<T> type,
ErrorCollection errors)
Converts the value in this JsonData to a generic type. |
Object |
getData()
|
Date |
getObjectDateProperty(String propertyname,
ErrorCollection errors)
|
Long |
getObjectLongProperty(String propertyname,
ErrorCollection errors)
|
String |
getObjectStringProperty(String propertyname,
String fieldName,
ErrorCollection errors)
|
boolean |
isArray()
|
boolean |
isNull()
|
boolean |
isObject()
|
boolean |
isString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JsonData
public JsonData(Object data)
getData
public Object getData()
isNull
public boolean isNull()
asString
public String asString()
asString
public String asString(String fieldName,
ErrorCollection errors)
isString
public boolean isString()
asObject
public Map<String,Object> asObject()
isObject
public boolean isObject()
isArray
public boolean isArray()
asArray
public List<?> asArray()
asArrayOfStrings
public List<String> asArrayOfStrings(boolean allowNulls,
String fieldName,
ErrorCollection errors)
asArrayOfObjectsWithId
public List<String> asArrayOfObjectsWithId(String fieldName,
ErrorCollection errors)
asObjectWithProperty
public String asObjectWithProperty(String propertyname,
String fieldName,
ErrorCollection errors)
asObjectWithProperty
public String asObjectWithProperty(String propertyname,
String fieldName,
boolean expected,
ErrorCollection errors)
asArrayOfObjectsWithProperty
public List<String> asArrayOfObjectsWithProperty(String propertyname,
String fieldName,
ErrorCollection errors)
getObjectLongProperty
public Long getObjectLongProperty(String propertyname,
ErrorCollection errors)
getObjectDateProperty
public Date getObjectDateProperty(String propertyname,
ErrorCollection errors)
getObjectStringProperty
public String getObjectStringProperty(String propertyname,
String fieldName,
ErrorCollection errors)
convertValue
public <T> T convertValue(String propertyname,
Class<T> type,
ErrorCollection errors)
convertValue
public <T> T convertValue(String fieldId,
TypeRef<T> type,
ErrorCollection errors)
- Converts the value in this JsonData to a generic type. To get a list of UserJsonBean, for example, use:
List<UserJsonBean> users = jsonData.convertValue("customfield_10000", new TypeRef<List<UserJsonBean>> {}, errors);
- Type Parameters:
T
- the type that we want to deserialise into- Parameters:
fieldId
- a String containing the field idtype
- a TypeRef used to capture the generic type information. this will generally be an anonymous classerrors
- an ErrorCollection to use for storing errors
- Returns:
- an instance of T, or null
Copyright © 2002-2012 Atlassian. All Rights Reserved.