Class MementoDb

java.lang.Object
org.yamcs.memento.MementoDb
All Implemented Interfaces:
ManagementListener

public class MementoDb extends Object implements ManagementListener
General purpose facility for persisting state information.
  • Method Details

    • getInstance

      public static MementoDb getInstance(String yamcsInstance)
      Retrieve a MementoDb for the given Yamcs instance.
    • getBoolean

      public Optional<Boolean> getBoolean(String key)
      Returns the boolean value of the given key.

      An empty optional is returned if the key is missing, or the value cannot be read as a boolean.

    • putBoolean

      public void putBoolean(String key, Boolean value)
      Sets the value of the given key to the given boolean value.
    • getNumber

      public Optional<Number> getNumber(String key)
      Returns the number value of the given key.

      An empty optional is returned if the key is missing, or the value cannot be read as a number.

    • putNumber

      public void putNumber(String key, Number value)
      Sets the value of the given key to the given number value.
    • getString

      public Optional<String> getString(String key)
      Returns the string value of the given key.

      An empty optional is returned if the key is missing, or the value cannot be read as a string.

    • putString

      public void putString(String key, String value)
      Sets the value of the given key to the given string value.
    • getJsonObject

      public Optional<com.google.gson.JsonObject> getJsonObject(String key)
      Returns the JsonObject value of the given key.

      An empty optional is returned if the key is missing, or the value cannot be read as a JsonObject.

    • putJsonObject

      public void putJsonObject(String key, com.google.gson.JsonObject value)
      Sets the value of the given key to the given JsonObject value.
    • getJsonArray

      public Optional<com.google.gson.JsonArray> getJsonArray(String key)
      Returns the JsonArray value of the given key.

      An empty optional is returned if the key is missing, or the value cannot be read as a JsonArray.

    • putJsonArray

      public void putJsonArray(String key, com.google.gson.JsonArray value)
      Sets the value of the given key to the given JsonArray value.
    • getObject

      public <T> Optional<T> getObject(String key, Class<T> clazz)
      Retrieves an object saved as memento. The object is deserialized using GSON.
    • putObject

      public <T> void putObject(String key, T object)
      Sets the value of the given key by serializing the provided object using GSON.