Class ConstantPoolKey

java.lang.Object
com.vaadin.flow.internal.ConstantPoolKey
All Implemented Interfaces:
Serializable

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.

For internal use only. May be renamed or removed in a future release.

Since:
1.0
Author:
Vaadin Ltd
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ConstantPoolKey(elemental.json.JsonValue json)
    Creates a new constant pool key for the given JSON value.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    export(elemental.json.JsonObject clientConstantPoolUpdate)
    Exports this key into a JSON object to send to the client.
    Gets the id used to identify the referenced JSON constant.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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, not null
  • Method Details

    • 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 this key into a JSON object to send to the client. This method should be called only by the ConstantPool 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, not null