Package com.vaadin.flow.internal
Class ConstantPoolKey
java.lang.Object
com.vaadin.flow.internal.ConstantPoolKey
- All Implemented Interfaces:
Serializable
Wraps a JSON value that should be stored in the
ConstantPool
shared
between the client and the server. A constant pool key stored as a value in a
state node will be encoded as a string containing the id that the client can
use for fetching the actual JSON value from the client-side constant pool.
This is a way of deduplicating JSON values that are expected to be sent to
the same client multiple times, since all references to the same JSON
structure will be encoded as the same id.
For internal use only. May be renamed or removed in a future release.
- Since:
- 1.0
- Author:
- Vaadin Ltd
- See Also:
-
Constructor Summary
ConstructorDescriptionConstantPoolKey
(elemental.json.JsonValue json) Creates a new constant pool key for the given JSON value. -
Method Summary
-
Constructor Details
-
ConstantPoolKey
public ConstantPoolKey(elemental.json.JsonValue json) Creates a new constant pool key for the given JSON value. The value should not be modified after this instance has been created since it might cause the constant pool value to be inconsistent.- Parameters:
json
- the JSON constant, notnull
-
-
Method Details
-
getId
Gets the id used to identify the referenced JSON constant.- Returns:
- the id used to identify this value
-
export
public void export(elemental.json.JsonObject clientConstantPoolUpdate) Exports this key into a JSON object to send to the client. This method should be called only by theConstantPool
instance that manages this value. It may be called multiple times.- Parameters:
clientConstantPoolUpdate
- the constant pool update that is to be sent to the client, notnull
-