All Known Subinterfaces:
NamespaceStorage.GlobalStorage, OnDemandSchemaTreeStorage

public interface NamespaceStorage
A hierarchical entity storing a portion (or entirety) of a ParserNamespace.
  • Method Details

    • getStorageType

      @NonNull NamespaceStorage.StorageType getStorageType()
      Return the type of this storage.
      Returns:
      The type of this storage
    • getParentStorage

      @Nullable NamespaceStorage getParentStorage()
      Return the parent NamespaceStorage. If this storage is NamespaceStorage.StorageType.GLOBAL, this method will return null.
      Returns:
      Parent storage, if this is not the global storage
    • getFromLocalStorage

      <K, V> @Nullable V getFromLocalStorage(ParserNamespace<K,V> type, K key)
    • getAllFromLocalStorage

      <K, V> @Nullable Map<K,V> getAllFromLocalStorage(ParserNamespace<K,V> type)
    • putToLocalStorage

      <K, V> @Nullable V putToLocalStorage(ParserNamespace<K,V> type, K key, V value)
      Populate specified namespace with a key/value pair, overwriting previous contents. Similar to Map.put(Object, Object).
      Type Parameters:
      K - Namespace key type
      V - Namespace value type
      Parameters:
      type - Namespace identifier
      key - Key
      value - Value
      Returns:
      Previously-stored value, or null if the key was not present
    • putToLocalStorageIfAbsent

      <K, V> @Nullable V putToLocalStorageIfAbsent(ParserNamespace<K,V> type, K key, V value)
      Populate specified namespace with a key/value pair unless the key is already associated with a value. Similar to Map.putIfAbsent(Object, Object).
      Type Parameters:
      K - Namespace key type
      V - Namespace value type
      Parameters:
      type - Namespace identifier
      key - Key
      value - Value
      Returns:
      Preexisting value or null if there was no previous mapping