Class JsonUdtValue
- java.lang.Object
-
- de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
-
- de.aristaflow.adept2.model.datamanagement.JsonUdtValue
-
- All Implemented Interfaces:
UDTValue
,Serializable
public class JsonUdtValue extends ADEPT2UDTValue
A User Defined Type for JSON data.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
UDT_NAME
TheADEPT2UDTValue.getUserDefinedType()
of the user defined type.-
Fields inherited from class de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
stream, userDefinedTypeName, value
-
-
Constructor Summary
Constructors Constructor Description JsonUdtValue(byte[] value)
JsonUdtValue(InputStream stream)
JsonUdtValue(InputStream stream, boolean eager)
JsonUdtValue(InputStream stream, int length)
JsonUdtValue(org.json.JSONObject json)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.json.JSONObject
fromByteArray(byte[] bytes)
Returns the JSON object from the given byte array or null if there is no data.static org.json.JSONObject
fromUDTValue(UDTValue udt)
Returns the JSON object from the given UDT or null if there is no data.org.json.JSONObject
getValueAsJsonObject()
Returns the current value as JSON object or null if there is no data.static String
rawTextFromUDTValue(UDTValue udtValue)
Reads the JSON from theUDTValue
as a raw string.static byte[]
toUtf8Bytes(org.json.JSONObject json)
Converts the given JSONObject to a UTF-8 encoded byte array.static UDTValue
udtValueFromRawText(String jsonText)
Returns anUDTValue
from the raw JSON string.-
Methods inherited from class de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
equals, finalize, getUserDefinedType, getValueAsArray, getValueAsStream, hashCode, readStream, toString
-
-
-
-
Field Detail
-
UDT_NAME
public static final String UDT_NAME
TheADEPT2UDTValue.getUserDefinedType()
of the user defined type.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JsonUdtValue
public JsonUdtValue(org.json.JSONObject json)
-
JsonUdtValue
public JsonUdtValue(byte[] value)
-
JsonUdtValue
public JsonUdtValue(InputStream stream, boolean eager)
-
JsonUdtValue
public JsonUdtValue(InputStream stream, int length)
-
JsonUdtValue
public JsonUdtValue(InputStream stream)
-
-
Method Detail
-
toUtf8Bytes
public static byte[] toUtf8Bytes(org.json.JSONObject json)
Converts the given JSONObject to a UTF-8 encoded byte array.- Parameters:
json
- The JSON object to be converted.- Returns:
- The byte array.
-
getValueAsJsonObject
public org.json.JSONObject getValueAsJsonObject()
Returns the current value as JSON object or null if there is no data.- Returns:
- The UDT value as JSON object or null if there is no data.
-
fromUDTValue
public static org.json.JSONObject fromUDTValue(UDTValue udt)
Returns the JSON object from the given UDT or null if there is no data.- Returns:
- The JSON object or null if there is no data.
-
fromByteArray
public static org.json.JSONObject fromByteArray(byte[] bytes)
Returns the JSON object from the given byte array or null if there is no data.- Returns:
- The JSON object or null if there is no data.
-
rawTextFromUDTValue
public static String rawTextFromUDTValue(UDTValue udtValue)
Reads the JSON from theUDTValue
as a raw string.- Parameters:
udtValue
- the JSON UDT value- Returns:
- the JSON as a raw string
-
-