@PublicApi public class

JsonData

extends Object
java.lang.Object
   ↳ com.atlassian.jira.issue.fields.rest.json.JsonData

@PublicApi

This class is designed for plugins to consume (call its methods).

Clients of @PublicApi can expect that programs compiled against a given version will remain binary compatible with later versions of the @PublicApi as per each product's API policy as long as the client does not implement/extend @PublicApi interfaces or classes (refer to each product's API policy for the exact guarantee---usually binary compatibility is guaranteed at least across minor versions).

Note: since @PublicApi interfaces and classes are not designed to be implemented or extended by clients, we may perform certain types of binary-incompatible changes to these classes and interfaces, but these will not affect well-behaved clients that do not extend/implement these types (in general, only classes and interfaces annotated with @PublicSpi are safe to extend/implement).

Summary

Public Constructors
JsonData(Object data)
Public Methods
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<StringObject> asObject()
String asObjectWithProperty(String propertyname, String fieldName, ErrorCollection errors)
String asObjectWithProperty(String propertyname, String fieldName, boolean expected, ErrorCollection errors)
String asString()
String asString(String fieldName, ErrorCollection errors)
<T> T convertValue(String propertyname, Class<T> type, ErrorCollection errors)
<T> T 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()
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public JsonData (Object data)

Public Methods

public List<?> asArray ()

public List<String> asArrayOfObjectsWithId (String fieldName, ErrorCollection errors)

public List<String> asArrayOfObjectsWithProperty (String propertyname, String fieldName, ErrorCollection errors)

public List<String> asArrayOfStrings (boolean allowNulls, String fieldName, ErrorCollection errors)

public Map<StringObject> asObject ()

public String asObjectWithProperty (String propertyname, String fieldName, ErrorCollection errors)

public String asObjectWithProperty (String propertyname, String fieldName, boolean expected, ErrorCollection errors)

public String asString ()

public String asString (String fieldName, ErrorCollection errors)

public T convertValue (String propertyname, Class<T> type, ErrorCollection errors)

public 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);
 

Parameters
fieldId a String containing the field id
type a TypeRef used to capture the generic type information. this will generally be an anonymous class
errors an ErrorCollection to use for storing errors
Returns
  • an instance of T, or null

public Object getData ()

public Date getObjectDateProperty (String propertyname, ErrorCollection errors)

public Long getObjectLongProperty (String propertyname, ErrorCollection errors)

public String getObjectStringProperty (String propertyname, String fieldName, ErrorCollection errors)

public boolean isArray ()

public boolean isNull ()

public boolean isObject ()

public boolean isString ()