Class ConfigBean

java.lang.Object
com.tccc.kos.commons.core.service.config.ConfigBean
All Implemented Interfaces:
Ready
Direct Known Subclasses:
BaseAppConfig, BaseDeviceConfig, ConfigSerialNumberProviderConfig, RegionSettings

public class ConfigBean extends Object implements Ready
Optional base class for config beans. If used, the ConfigService will set configured to true once it sets the values in the bean. Very useful for knowing when a bean has been configured. This class also implements Ready, which means services that have config beans can mark the field @WhenReady, and onReady() will be called after the bean is configured.
Since:
1.0
Version:
2022-08-30
  • Constructor Details

    • ConfigBean

      public ConfigBean()
  • Method Details

    • isConfigured

      public boolean isConfigured()
      Returns true once the bean is configured.
      Returns:
      true once configured
    • addListener

      public void addListener(ConfigBeanListener listener)
      Add a listener to the list.
      Parameters:
      listener - the listener to add
    • removeListener

      public void removeListener(ConfigBeanListener listener)
      Remove a listener from the list.
      Parameters:
      listener - the listener to remove
    • getReady

      public ReadyIndicator getReady()
      Override for Ready interface.
      Specified by:
      getReady in interface Ready
      Returns:
      the associated ReadyIndicator object
    • update

      public ConfigChanges update(String attr, Object val)
      Update the specified attribute of the config bean.
      Parameters:
      attr - the config attribute to update in dotted notation
      val - the new value (converted to simple type)
      Returns:
      the changes applied to the config
    • update

      public ConfigChanges update(Map<String,Object> attrs)
      Update the attributes of the config for the specified bean to the values specified in the map.
      Parameters:
      attrs - the attribute names / values to update
      Returns:
      the changes applied to the config