Interface ConfigurationProperty<VIEWT>

Type Parameters:
VIEWT - Type of the value.
All Known Subinterfaces:
ConfigurationTree<VIEWT,CHANGET>, ConfigurationValue<VIEWT>, NamedConfigurationTree<T,VIEWT,CHANGET>

public interface ConfigurationProperty<VIEWT>
Base interface for configuration.
  • Method Details

    • key

      String key()
      Get key of this node.
    • value

      VIEWT value()
      Get value of this property.
    • listen

      void listen(ConfigurationListener<VIEWT> listener)
      Adds configuration values listener.

      NOTE: If this method is called from another listener, then it is guaranteed to be called starting from the next configuration update only.

      Parameters:
      listener - Listener.
    • stopListen

      void stopListen(ConfigurationListener<VIEWT> listener)
      Removes configuration values listener.

      NOTE: Unpredictable behavior if the method is called inside other listeners.

      Parameters:
      listener - Listener.
    • directProxy

      <T extends ConfigurationProperty<VIEWT>> T directProxy()
      Returns a configuration tree for the purpose of reading configuration directly from the underlying storage. Actual reading is only happening while invoking value(). It will either throw NoSuchElementException, unchecked runtime exception, or return the value.

      It is important to understand how it processes named list elements. Imagine having element named a with internalId aId.

      
           var namedListProxy = namedList.directProxy();
      
           // Creates another proxy.
           var aElementProxy = namedListProxy.get("a");
      
           // This operation performs actual reading. It'll throw an exception if element named "a" doesn't exist anymore.
           // It's been renamed or deleted.
           var aElement = aElementProxy.value();
      
           // Creates another proxy.
           var aIdElementProxy = namedListProxy.get(aId);
      
           // This operation performs actual reading as previously stated. But, unlike the access by name, it won't throw an exception in
           // case of a rename. Only after deletion.
           var aIdElement = aIdElementProxy.value();
       

      Another important case is how already resolved named list elements are being proxied.

      
           // Following code is in fact equivalent to a "namedList.directProxy().get(aId);"
           // Already resolved elements are always referenced to by their internal ids. This means that proxy will return a valid value
           // even after rename despite it looking like name "a" should be resolved once again.
           var aElementProxy = namedList.get("a").directProxy();