Package io.camunda.zeebe.client.impl
Class ZeebeObjectMapper
- java.lang.Object
-
- io.camunda.zeebe.client.impl.ZeebeObjectMapper
-
- All Implemented Interfaces:
JsonMapper
public final class ZeebeObjectMapper extends Object implements JsonMapper
-
-
Constructor Summary
Constructors Constructor Description ZeebeObjectMapper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TfromJson(String json, Class<T> typeClass)Deserializes a JSON string into an equivalent POJO of typeT.Map<String,Object>fromJsonAsMap(String json)Deserializes a JSON string into a string to object map.Map<String,String>fromJsonAsStringMap(String json)Deserializes a JSON string into a string to string map.StringtoJson(Object value)Serializes an object (POJO, map, list, etc.) into an JSON string.StringvalidateJson(String propertyName, InputStream jsonInput)Validates a stream that contains a JSON string.StringvalidateJson(String propertyName, String jsonInput)Validates a JSON string.
-
-
-
Method Detail
-
fromJson
public <T> T fromJson(String json, Class<T> typeClass)
Description copied from interface:JsonMapperDeserializes a JSON string into an equivalent POJO of typeT.- Specified by:
fromJsonin interfaceJsonMapper- Type Parameters:
T- the type of the returned object- Parameters:
json- the JSON string to deserializetypeClass- the Java type to deserialize into- Returns:
- the POJO deserialized from the given JSON string
-
fromJsonAsMap
public Map<String,Object> fromJsonAsMap(String json)
Description copied from interface:JsonMapperDeserializes a JSON string into a string to object map.- Specified by:
fromJsonAsMapin interfaceJsonMapper- Parameters:
json- the JSON string to deserialize- Returns:
- the map deserialized from the given JSON string
-
fromJsonAsStringMap
public Map<String,String> fromJsonAsStringMap(String json)
Description copied from interface:JsonMapperDeserializes a JSON string into a string to string map.- Specified by:
fromJsonAsStringMapin interfaceJsonMapper- Parameters:
json- the JSON string to deserialize- Returns:
- the map deserialized from the given JSON string
-
toJson
public String toJson(Object value)
Description copied from interface:JsonMapperSerializes an object (POJO, map, list, etc.) into an JSON string.- Specified by:
toJsonin interfaceJsonMapper- Parameters:
value- the object to serialize- Returns:
- a JSON string serialized from the given object
-
validateJson
public String validateJson(String propertyName, String jsonInput)
Description copied from interface:JsonMapperValidates a JSON string. If it is not valid throws aInternalClientException.- Specified by:
validateJsonin interfaceJsonMapper- Parameters:
propertyName- the property name that contains the JSON stringjsonInput- the JSON string- Returns:
- the same JSON string, that passed in
-
validateJson
public String validateJson(String propertyName, InputStream jsonInput)
Description copied from interface:JsonMapperValidates a stream that contains a JSON string. If it is not valid throws aInternalClientException- Specified by:
validateJsonin interfaceJsonMapper- Parameters:
propertyName- a property name that contains the streamjsonInput- the stream that contains the JSON string- Returns:
- the JSON string from the stream
-
-