Class ChartSerialization

java.lang.Object
com.vaadin.flow.component.charts.util.ChartSerialization
All Implemented Interfaces:
Serializable

public class ChartSerialization extends Object implements Serializable
Util class that handles the configuration needed for the model classes to be serialized to JSON.
Since:
6.0.1
See Also:
  • Method Details

    • createObjectMapper

      public static tools.jackson.databind.ObjectMapper createObjectMapper()
      Create the default ObjectMapper used 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 the ObjectMapper object 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() or createObjectMapper(ValueSerializerModifier) cannot serialize ChartFunction values: build the writer with createObjectMapper() or createObjectMapper(ValueSerializerModifier) to use them.

      Parameters:
      newObjectWriter -
      See Also:
    • toJSON

      public static String toJSON(AbstractConfigurationObject object)
      Serializes the given configuration object to JSON. A ChartFunction value is left out: use toJsonWithFunctions(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 its ChartFunction values 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