com.vaadin.flow.internal.
Class ConstantPoolKey
- java.lang.Object
-
- com.vaadin.flow.internal.ConstantPoolKey
-
All Implemented Interfaces:
public class ConstantPoolKey extends Object implements 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.Since:
1.0
Author:
Vaadin Ltd
See Also:
-
-
Constructor Summary
Constructors Constructor and Description ConstantPoolKey(elemental.json.JsonValue json)
Creates a new constant pool key for the given JSON value.
-
-
-
Constructor Detail
-
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 Detail
-
getId
public String 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 the this key into a JSON object to send to the client. This method should only be called once and only by the
ConstantPool
instance that manages this value.Parameters:
clientConstantPoolUpdate
- the constant pool update that is to be sent to the client, notnull
-
-