Class ConfigValue

java.lang.Object
com.tccc.kos.commons.core.service.config.ConfigValue

public class ConfigValue extends Object
Bean returned from fetching an individual config value from ConfigService. This records the value and when the value was last set. When the value derives from a default value, lastUpdateTime will be zero. When it derives from a MutableConfigSource then it will be the time the value as last set.

If a value is the result of evaluating multiple scopes, it's possible for a default value in a higher scope to replace an override in a lower scope, thus the lastUpdateTime will be zero to reflect the resulting final value derived from the default value.

Version:
2024-08-09
  • Constructor Details

    • ConfigValue

      public ConfigValue()
  • Method Details

    • setValue

      public void setValue(String value)
      Set the associated value. Calling this will have the side effect of setting the valid flag. As most sources are not MutableConfigSource , calling setValue() will also set the lastUpdateTime to zero. Any mutable source must also update the lastUpdateTime after setting the value.
      Parameters:
      value - the new value
    • isValid

      public boolean isValid()
      Returns true if the value was found in the config, or false if there was no reference to the attribute anywhere in the config stack. This allows value methods to never return null but the caller can check whether the value existed and is null, or never existed.
    • getValue

      public String getValue()
    • getLastUpdateTime

      public long getLastUpdateTime()
    • setLastUpdateTime

      public void setLastUpdateTime(long lastUpdateTime)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object