JsonSerializable Class

定义

Represents a base resource that can be serialized to JSON in the Azure Cosmos DB database service.

Note on Serializable: this interface is implemented solely for the use with the CosmosDB Spark Connector. In RDD transformation, it is a requirement of the RDD item type to be Serializable so that they can be transferred among the work nodes by the default serializer. The Serializable is not intended to be used by the user of the Cosmos DB Java SDK. Avoid relying on the serialized string format as it can change in the future.

public class JsonSerializable
继承
java.lang.Object
Serializable
JsonSerializable

构造函数

JsonSerializable()
JsonSerializable(JSONObject jsonObject)

Constructor.

JsonSerializable(String jsonString)

Constructor.

JsonSerializable(String jsonString, ObjectMapper objectMapper)

Constructor.

方法

get(String propertyName)

Gets a property value as Object.

getBoolean(String propertyName)

Gets a boolean value.

getCollection(String propertyName)

Gets a JSONObject collection.

getCollection(String propertyName, Class<T> c)

Gets an object collection.

getDouble(String propertyName)

Gets a double value.

getHashMap()

Returns the propertybag(JSONObject) in a hashMap

getInt(String propertyName)

Gets an integer value.

getLogger()
getLong(String propertyName)

Gets a long value.

getMapper()
getObject(String propertyName)

Gets a JSONObject.

getObject(String propertyName, Class<T> c)

Gets an object value.

getObjectByPath(Collection<String> propertyNames)

Gets the value of a property identified by an array of property names that forms the path.

getString(String propertyName)

Gets a string value.

has(String propertyName)

Checks whether a property exists.

remove(String propertyName)

Removes a value by propertyName.

set(String propertyName, T value)

Sets the value of a property.

toJson()

Converts to a JSON string.

toJson(SerializationFormattingPolicy formattingPolicy)

Converts to a JSON string.

toObject(Class<T> c)

Converts to an Object (only POJOs and JSONObject are supported).

toString()

Gets Simple String representation of property bag.

For proper conversion to json and inclusion of the default values use toJson().

toString(int indentFactor)

Gets formatted String representation of property bag.

Deprecated

For proper conversion to json and inclusion of the default values use toJson(SerializationFormattingPolicy).

适用于