T
- The type of the value for which the handler is responsible.public interface JsonHandler<T>
JsonElement
. The object can be a native
(Integer
, String
, etc...) or a complex (Page
, FormData
, etc...) object.
CAUTION:
This class is still in development and may change drastically without any further notice.JsonGenerationContext
,
JsonElement
,
JsonSupporting
,
JsonSupporting
Modifier and Type | Method and Description |
---|---|
Class<T> |
getSupportedClass()
This method provides the class for which the handler is responsible.
|
JsonElement<?> |
handle(JsonGenerationContext context,
T value)
This method transforms the given value to a valid
JsonElement . |
@NotNull JsonElement<?> handle(@NotNull JsonGenerationContext context, @NotNull T value)
JsonElement
. Use json api to create json structure.
Attention: This call should return very fast and should not make any calls to remote services.
Example:
JsonObject.create(). put(JsonPair.of("myText", JsonStringValue.of(myTextValue))). put(JsonPair.of("myNumber", JsonNumberValue.of(myNumberValue)));
context
- The JsonGenerationContext
for rendering this value.value
- The value that needs handling.JsonElement
representing the given value in json.getSupportedClass()
@NotNull Class<T> getSupportedClass()
handle(JsonGenerationContext, Object)
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210