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 String
UDT_NAME
TheADEPT2UDTValue.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 newUDTValue
for 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 aBoundedInputStream
instead.JsonUdtValue(String jsonString)
Creates a newUDTValue
for 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 newUDTValue
for the designatedJSONObject
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated 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)
Gets theJSONObject
from the designated UDT ornull
if there is no data.static org.json.JSONObject
fromUDTValue(UDTValue udt)
Deprecated, for removal: This API element is subject to removal in a future version.UsefromUdtValue(UDTValue)
instead.org.json.JSONObject
getJsonObject()
Gets the current value asJSONObject
ornull
if there is no data.static String
getJsonString(UDTValue udtValue)
Gets the string content of the designatedUDTValue
.org.json.JSONObject
getValueAsJsonObject()
Deprecated, for removal: This API element is subject to removal in a future version.UsegetJsonObject()
instead.static String
rawTextFromUDTValue(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 InputStream
toUtf8InputStream(org.json.JSONObject json)
Gets an input stream containing the UTF-8 string representing the designatedJSONObject
.static UDTValue
udtValueFromRawText(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 IOException
Creates a newUDTValue
for the designatedJSONObject
.- Parameters:
json
- TheJSONObject
for 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, anIOException
will 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 newUDTValue
for the designated string. This should represent a validJSONObject
.- Parameters:
jsonString
- The string representing aJSONObject
for which to create aUDTValue
.- Throws:
IOException
- If there are problems creating the input stream or reading from it, anIOException
will 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 aBoundedInputStream
instead.
-
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 newUDTValue
for 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 aJSONObject
for 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, anIOException
will 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
- TheJSONObject
for 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, anIOException
will 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 IOException
Gets the current value asJSONObject
ornull
if there is no data.- Returns:
- The UDT value as
JSONObject
ornull
if there is no data. - Throws:
IOException
- If there are problems reading the content of the designatedUDTValue
, anIOException
will 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 theJSONObject
from the designated UDT ornull
if there is no data. The designatedUDTValue
has to contain a valid JSON object (as UTF-8 encoded string).- Parameters:
udt
- TheUDTValue
containing a UTF-8 encoded string representing aJSONObject
. The caller is responsible for closing.- Returns:
- The
JSONObject
ornull
if there is no data. - Throws:
IOException
- If there are problems reading the content of the designatedUDTValue
, anIOException
will be thrown.IllegalArgumentException
- If the designatedUDTValue
has the wrong type, anIllegalArgumentException
will 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 theUDTValue
as 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
- TheUDTValue
from 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
, anIOException
will be thrown.IllegalArgumentException
- If the designatedUDTValue
has the wrong type, anIllegalArgumentException
will 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 anUDTValue
from the raw JSON string.- Parameters:
jsonText
- the raw JSON text- Returns:
- an
UDTValue
containing the JSON
-
-