Class ChartFunctionSerializer.Collector
java.lang.Object
com.vaadin.flow.component.charts.model.serializers.ChartFunctionSerializer.Collector
- All Implemented Interfaces:
Serializable
- Enclosing class:
ChartFunctionSerializer
Collects the functions of one serialization, and finds where they are in
the resulting JSON.
The path of a function can not be taken while serializing: the generator that builds a JSON tree does not keep track of array indexes. So a placeholder is written instead, and found in the tree afterwards, in the same walk that looks for functions given as strings.
For internal use only. May be renamed or removed in a future release.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidextract(tools.jackson.databind.JsonNode json, boolean findStringFunctions) Removes the placeholders from the given JSON, and records the path and the function of each.Gets the functions found byextract(JsonNode, boolean).tools.jackson.databind.node.ArrayNodegetPaths()Gets the paths of the functions found byextract(JsonNode, boolean), in the order ofgetFunctions().booleanGets whetherextract(JsonNode, boolean)found a function given as a string.
-
Constructor Details
-
Collector
public Collector()
-
-
Method Details
-
extract
public void extract(tools.jackson.databind.JsonNode json, boolean findStringFunctions) Removes the placeholders from the given JSON, and records the path and the function of each. A placeholder in an object is removed with its property, and one in an array is replaced withnull. In the same walk, optionally looks for a function given as a string, under a key that starts with_fn_.Does not walk the JSON when there are no placeholders and no string functions to look for.
- Parameters:
json- the JSON written with this collector, notnullfindStringFunctions- whether to look for functions given as strings
-
getPaths
public tools.jackson.databind.node.ArrayNode getPaths()Gets the paths of the functions found byextract(JsonNode, boolean), in the order ofgetFunctions(). Each path is an array of property names and array indexes.- Returns:
- the paths, not
null
-
getFunctions
Gets the functions found byextract(JsonNode, boolean).- Returns:
- the functions, not
null
-
hasStringFunction
public boolean hasStringFunction()Gets whetherextract(JsonNode, boolean)found a function given as a string.- Returns:
trueif the JSON has a function as a string
-