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> T
fromJson(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.String
toJson(Object value)
Serializes an object (POJO, map, list, etc.) into an JSON string.String
validateJson(String propertyName, InputStream jsonInput)
Validates a stream that contains a JSON string.String
validateJson(String propertyName, String jsonInput)
Validates a JSON string.
-
-
-
Method Detail
-
fromJson
public <T> T fromJson(String json, Class<T> typeClass)
Description copied from interface:JsonMapper
Deserializes a JSON string into an equivalent POJO of typeT
.- Specified by:
fromJson
in 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:JsonMapper
Deserializes a JSON string into a string to object map.- Specified by:
fromJsonAsMap
in 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:JsonMapper
Deserializes a JSON string into a string to string map.- Specified by:
fromJsonAsStringMap
in 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:JsonMapper
Serializes an object (POJO, map, list, etc.) into an JSON string.- Specified by:
toJson
in 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:JsonMapper
Validates a JSON string. If it is not valid throws aInternalClientException
.- Specified by:
validateJson
in 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:JsonMapper
Validates a stream that contains a JSON string. If it is not valid throws aInternalClientException
- Specified by:
validateJson
in interfaceJsonMapper
- Parameters:
propertyName
- a property name that contains the streamjsonInput
- the stream that contains the JSON string- Returns:
- the JSON string from the stream
-
-