Class JsonUdtValue
- java.lang.Object
-
- de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
-
- de.aristaflow.adept2.model.datamanagement.JsonUdtValue
-
- All Implemented Interfaces:
UDTValue,TypedCloneable<ADEPT2UDTValue>,Closeable,Serializable,AutoCloseable,Cloneable
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 StringUDT_NAMETheADEPT2UDTValue.getUserDefinedType()of the user defined type.-
Fields inherited from class de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
cleanup, data, userDefinedTypeName
-
-
Constructor Summary
Constructors Constructor Description JsonUdtValue(byte[] value)Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream, boolean[])instead.JsonUdtValue(InputStream stream)Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream, boolean[])instead.JsonUdtValue(InputStream stream, boolean eager)Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream)instead.JsonUdtValue(InputStream stream, boolean... dummy)Creates a newUDTValuefor the designated input stream containing a UTF-8 encoded string representing aJSONObject.JsonUdtValue(InputStream stream, int length)Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream, boolean[])with aBoundedInputStreaminstead.JsonUdtValue(String jsonString)Creates a newUDTValuefor the designated string.JsonUdtValue(org.json.JSONObject json)Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(JSONObject, boolean[])instead.JsonUdtValue(org.json.JSONObject json, boolean... dummy)Creates a newUDTValuefor the designatedJSONObject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.json.JSONObjectfromByteArray(byte[] bytes)Returns the JSON object from the given byte array or null if there is no data.static org.json.JSONObjectfromUdtValue(UDTValue udt)Gets theJSONObjectfrom the designated UDT ornullif there is no data.static org.json.JSONObjectfromUDTValue(UDTValue udt)Deprecated, for removal: This API element is subject to removal in a future version.UsefromUdtValue(UDTValue)instead.org.json.JSONObjectgetJsonObject()Gets the current value asJSONObjectornullif there is no data.static StringgetJsonString(UDTValue udtValue)Gets the string content of the designatedUDTValue.org.json.JSONObjectgetValueAsJsonObject()Deprecated, for removal: This API element is subject to removal in a future version.UsegetJsonObject()instead.static StringrawTextFromUDTValue(UDTValue udtValue)Deprecated, for removal: This API element is subject to removal in a future version.UsegetJsonString(UDTValue)instead.static byte[]toUtf8Bytes(org.json.JSONObject json)Deprecated, for removal: This API element is subject to removal in a future version.UsetoUtf8InputStream(JSONObject)instead.static InputStreamtoUtf8InputStream(org.json.JSONObject json)Gets an input stream containing the UTF-8 string representing the designatedJSONObject.static UDTValueudtValueFromRawText(String jsonText)Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(String)instead.-
Methods inherited from class de.aristaflow.adept2.model.datamanagement.ADEPT2UDTValue
clone, clone, cloneUnchecked, close, equals, getBytes, getInputStream, getSize, getUserDefinedType, getValueAsArray, getValueAsStream, hashCode, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.aristaflow.adept2.model.datamanagement.UDTValue
getContentString, getSize, isEmpty
-
-
-
-
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
@Deprecated(since="15.0.0", forRemoval=true) public JsonUdtValue(org.json.JSONObject json)
Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(JSONObject, boolean[])instead.
-
JsonUdtValue
public JsonUdtValue(org.json.JSONObject json, boolean... dummy) throws IOExceptionCreates a newUDTValuefor the designatedJSONObject.- Parameters:
json- TheJSONObjectfor which to create aUDTValue.dummy- Ignored, just distinguishes from the deprecated constructor.- Throws:
IOException- If there are problems creating the input stream or reading from it, anIOExceptionwill be thrown.
-
JsonUdtValue
@Deprecated(since="15.0.0", forRemoval=true) public JsonUdtValue(byte[] value)
Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream, boolean[])instead.
-
JsonUdtValue
public JsonUdtValue(String jsonString) throws IOException
Creates a newUDTValuefor the designated string. This should represent a validJSONObject.- Parameters:
jsonString- The string representing aJSONObjectfor which to create aUDTValue.- Throws:
IOException- If there are problems creating the input stream or reading from it, anIOExceptionwill be thrown.
-
JsonUdtValue
@Deprecated(since="15.0.0", forRemoval=true) public JsonUdtValue(InputStream stream, boolean eager)
Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream)instead.
-
JsonUdtValue
@Deprecated(since="15.0.0", forRemoval=true) public JsonUdtValue(InputStream stream, int length)
Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream, boolean[])with aBoundedInputStreaminstead.
-
JsonUdtValue
@Deprecated(since="15.0.0", forRemoval=true) public JsonUdtValue(InputStream stream)
Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(InputStream, boolean[])instead.
-
JsonUdtValue
public JsonUdtValue(InputStream stream, boolean... dummy) throws IOException
Creates a newUDTValuefor the designated input stream containing a UTF-8 encoded string representing aJSONObject.- Parameters:
stream- The input stream containing the UTF-8 encoded string representation of aJSONObjectfor which to create aUDTValue. The stream will be closed after the creation.dummy- Ignored, just distinguishes from the deprecated constructor.- Throws:
IOException- If there are problems creating the data structures for the content, anIOExceptionwill be thrown.
-
-
Method Detail
-
toUtf8Bytes
@Deprecated(since="15.0.0", forRemoval=true) public static byte[] toUtf8Bytes(org.json.JSONObject json)
Deprecated, for removal: This API element is subject to removal in a future version.UsetoUtf8InputStream(JSONObject)instead.Converts the given JSONObject to a UTF-8 encoded byte array.- Parameters:
json- The JSON object to be converted.- Returns:
- The byte array.
-
toUtf8InputStream
public static InputStream toUtf8InputStream(org.json.JSONObject json) throws IOException
Gets an input stream containing the UTF-8 string representing the designatedJSONObject.- Parameters:
json- TheJSONObjectfor which to get an input stream.- Returns:
- An input stream containing the UTF-8 string representing the designated
JSONObject. - Throws:
IOException- If there are problems creating the input stream, anIOExceptionwill be thrown.
-
getValueAsJsonObject
@Deprecated(since="15.0.0", forRemoval=true) public org.json.JSONObject getValueAsJsonObject()
Deprecated, for removal: This API element is subject to removal in a future version.UsegetJsonObject()instead.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.
-
getJsonObject
public org.json.JSONObject getJsonObject() throws IOExceptionGets the current value asJSONObjectornullif there is no data.- Returns:
- The UDT value as
JSONObjectornullif there is no data. - Throws:
IOException- If there are problems reading the content of the designatedUDTValue, anIOExceptionwill be thrown.- See Also:
fromUdtValue(UDTValue)
-
fromUDTValue
@Deprecated(since="15.0.0", forRemoval=true) public static org.json.JSONObject fromUDTValue(UDTValue udt)
Deprecated, for removal: This API element is subject to removal in a future version.UsefromUdtValue(UDTValue)instead.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.
-
fromUdtValue
public static org.json.JSONObject fromUdtValue(UDTValue udt) throws IOException
Gets theJSONObjectfrom the designated UDT ornullif there is no data. The designatedUDTValuehas to contain a valid JSON object (as UTF-8 encoded string).- Parameters:
udt- TheUDTValuecontaining a UTF-8 encoded string representing aJSONObject. The caller is responsible for closing.- Returns:
- The
JSONObjectornullif there is no data. - Throws:
IOException- If there are problems reading the content of the designatedUDTValue, anIOExceptionwill be thrown.IllegalArgumentException- If the designatedUDTValuehas the wrong type, anIllegalArgumentExceptionwill be thrown.
-
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
@Deprecated(since="15.0.0", forRemoval=true) public static String rawTextFromUDTValue(UDTValue udtValue)
Deprecated, for removal: This API element is subject to removal in a future version.UsegetJsonString(UDTValue)instead.Reads the JSON from theUDTValueas a raw string.- Parameters:
udtValue- the JSON UDT value- Returns:
- the JSON as a raw string
-
getJsonString
public static String getJsonString(UDTValue udtValue) throws IOException
Gets the string content of the designatedUDTValue.- Parameters:
udtValue- TheUDTValuefrom which to get the content as string. The caller is responsible for closing.- Returns:
- The string content of the designated
UDTValue. - Throws:
IOException- If there are problems reading the content of the designatedUDTValue, anIOExceptionwill be thrown.IllegalArgumentException- If the designatedUDTValuehas the wrong type, anIllegalArgumentExceptionwill be thrown.
-
udtValueFromRawText
@Deprecated(since="15.0.0", forRemoval=true) public static UDTValue udtValueFromRawText(String jsonText)
Deprecated, for removal: This API element is subject to removal in a future version.UseJsonUdtValue(String)instead.Returns anUDTValuefrom the raw JSON string.- Parameters:
jsonText- the raw JSON text- Returns:
- an
UDTValuecontaining the JSON
-
-