Class ConfigValue
java.lang.Object
com.tccc.kos.commons.core.service.config.ConfigValue
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
long
getValue()
int
hashCode()
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.void
setLastUpdateTime
(long lastUpdateTime) void
Set the associated value.toString()
-
Constructor Details
-
ConfigValue
public ConfigValue()
-
-
Method Details
-
setValue
Set the associated value. Calling this will have the side effect of setting the valid flag. As most sources are notMutableConfigSource
, callingsetValue()
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
-
getLastUpdateTime
public long getLastUpdateTime() -
setLastUpdateTime
public void setLastUpdateTime(long lastUpdateTime) -
equals
-
hashCode
public int hashCode() -
toString
-