Class ChartSerialization
java.lang.Object
com.vaadin.flow.component.charts.util.ChartSerialization
- All Implemented Interfaces:
Serializable
Util class that handles the configuration needed for the model classes to be
serialized to JSON.
- Since:
- 6.0.1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA configuration object serialized to a JSON tree, and itsChartFunctionvalues. -
Method Summary
Modifier and TypeMethodDescriptionstatic tools.jackson.databind.ObjectMapperCreate the defaultObjectMapperused for serialization.static tools.jackson.databind.ObjectMappercreateObjectMapper(tools.jackson.databind.ser.ValueSerializerModifier modifier) static voidsetObjectMapperInstance(tools.jackson.databind.ObjectWriter newObjectWriter) This method can be used to configure theObjectMapperobject used to serialize configuration objects to client side.static StringtoJSON(AbstractConfigurationObject object) Serializes the given configuration object to JSON.Serializes the given configuration object to a JSON tree, and gets itsChartFunctionvalues separately, with the path of each in the tree.
-
Method Details
-
createObjectMapper
public static tools.jackson.databind.ObjectMapper createObjectMapper()Create the defaultObjectMapperused for serialization. -
createObjectMapper
public static tools.jackson.databind.ObjectMapper createObjectMapper(tools.jackson.databind.ser.ValueSerializerModifier modifier) -
setObjectMapperInstance
public static void setObjectMapperInstance(tools.jackson.databind.ObjectWriter newObjectWriter) This method can be used to configure theObjectMapperobject used to serialize configuration objects to client side. If users have made their extensions to underlying library and wish to build a typed Java API for it, adding custom serializers might be needed.A writer that is not built from
createObjectMapper()orcreateObjectMapper(ValueSerializerModifier)cannot serializeChartFunctionvalues: build the writer withcreateObjectMapper()orcreateObjectMapper(ValueSerializerModifier)to use them.- Parameters:
newObjectWriter-- See Also:
-
toJSON
Serializes the given configuration object to JSON. AChartFunctionvalue is left out: usetoJsonWithFunctions(AbstractConfigurationObject)to get the functions as well.- Parameters:
object- the object to serialize- Returns:
- the JSON
-
toJsonWithFunctions
public static ChartSerialization.JsonWithFunctions toJsonWithFunctions(AbstractConfigurationObject object) Serializes the given configuration object to a JSON tree, and gets itsChartFunctionvalues separately, with the path of each in the tree. The tree does not have the functions.For internal use only. May be renamed or removed in a future release.
- Parameters:
object- the object to serialize- Returns:
- the JSON tree and the functions
-