JsonSerializable Class
- java.
lang. Object - com.
microsoft. azure. cosmosdb. JsonSerializable
- com.
public class JsonSerializable
Represents a base resource that can be serialized to JSON in the Azure Cosmos DB database service.
Constructor Summary
Constructor | Description | |
---|---|---|
JsonSerializable() | ||
JsonSerializable(String jsonString) |
Constructor. |
|
JsonSerializable(String jsonString, ObjectMapper objectMapper) |
Constructor. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Object |
get(String propertyName)
Gets a property value as Object. |
Boolean |
getBoolean(String propertyName)
Gets a boolean value. |
Collection<ObjectNode> |
getCollection(String propertyName)
Gets a JSONObject collection. |
<T> Collection<T> |
getCollection(String propertyName, Class<T> c)
Gets an object collection. |
Double |
getDouble(String propertyName)
Gets a double value. |
HashMap<String, Object> |
getHashMap()
Returns the propertybag(JSONObject) in a hashMap |
Integer |
getInt(String propertyName)
Gets an integer value. |
<T> List<T> |
getList(String propertyName, Class<T> c)
Gets an object List. |
Logger | getLogger() |
Long |
getLong(String propertyName)
Gets a long value. |
ObjectMapper | getMapper() |
ObjectNode |
getObject(String propertyName)
Gets a JSONObject. |
<T> T |
getObject(String propertyName, Class<T> c)
Gets an object value. |
Object |
getObjectByPath(List<String> propertyNames)
Gets the value of a property identified by an array of property names that forms the path. |
String |
getString(String propertyName)
Gets a string value. |
boolean |
has(String propertyName)
Checks whether a property exists. |
void |
remove(String propertyName)
Removes a value by propertyName. |
<T> void |
set(String propertyName, T value)
Sets the value of a property. |
String |
toJson()
Converts to a JSON string. |
String |
toJson(SerializationFormattingPolicy formattingPolicy)
Converts to a JSON string. |
<T> T |
toObject(Class<T> c)
Converts to an Object (only POJOs and JSONObject are supported). |
String |
toString()
Gets Simple String representation of property bag. For proper conversion to json and inclusion of the default values use toJson(). |
Constructor Details
JsonSerializable
protected JsonSerializable()
JsonSerializable
protected JsonSerializable(String jsonString)
Constructor.
Parameters:
JsonSerializable
protected JsonSerializable(String jsonString, ObjectMapper objectMapper)
Constructor.
Parameters:
Method Details
get
public Object get(String propertyName)
Gets a property value as Object.
Parameters:
Returns:
getBoolean
public Boolean getBoolean(String propertyName)
Gets a boolean value.
Parameters:
Returns:
getCollection
public Collection
Gets a JSONObject collection.
Parameters:
Returns:
getCollection
public
Gets an object collection.
Parameters:
Returns:
getDouble
public Double getDouble(String propertyName)
Gets a double value.
Parameters:
Returns:
getHashMap
public HashMap
Returns the propertybag(JSONObject) in a hashMap
Returns:
getInt
public Integer getInt(String propertyName)
Gets an integer value.
Parameters:
Returns:
getList
public
Gets an object List.
Parameters:
Returns:
getLogger
protected Logger getLogger()
getLong
public Long getLong(String propertyName)
Gets a long value.
Parameters:
Returns:
getMapper
protected ObjectMapper getMapper()
getObject
public ObjectNode getObject(String propertyName)
Gets a JSONObject.
Parameters:
Returns:
getObject
public
Gets an object value.
Parameters:
Returns:
getObjectByPath
public Object getObjectByPath(List
Gets the value of a property identified by an array of property names that forms the path.
Parameters:
Returns:
getString
public String getString(String propertyName)
Gets a string value.
Parameters:
Returns:
has
public boolean has(String propertyName)
Checks whether a property exists.
Parameters:
Returns:
remove
public void remove(String propertyName)
Removes a value by propertyName.
Parameters:
set
public
Sets the value of a property.
Parameters:
toJson
public String toJson()
Converts to a JSON string.
Returns:
toJson
public String toJson(SerializationFormattingPolicy formattingPolicy)
Converts to a JSON string.
Parameters:
Returns:
toObject
public
Converts to an Object (only POJOs and JSONObject are supported).
Parameters:
Returns:
toString
public String toString()
Gets Simple String representation of property bag.
For proper conversion to json and inclusion of the default values use toJson().
Returns: