Class ConfigBean
java.lang.Object
com.tccc.kos.commons.core.service.config.ConfigBean
- All Implemented Interfaces:
Ready
- Direct Known Subclasses:
BaseAppConfig
,BaseDeviceConfig
,ConfigSerialNumberProviderConfig
,RegionSettings
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ConfigBeanListener listener) Add a listener to the list.getReady()
Override for Ready interface.boolean
Returns true once the bean is configured.void
removeListener
(ConfigBeanListener listener) Remove a listener from the list.Update the specified attribute of the config bean.Update the attributes of the config for the specified bean to the values specified in the map.
-
Constructor Details
-
ConfigBean
public ConfigBean()
-
-
Method Details
-
isConfigured
public boolean isConfigured()Returns true once the bean is configured.- Returns:
- true once configured
-
addListener
Add a listener to the list.- Parameters:
listener
- the listener to add
-
removeListener
Remove a listener from the list.- Parameters:
listener
- the listener to remove
-
getReady
Override for Ready interface. -
update
Update the specified attribute of the config bean.- Parameters:
attr
- the config attribute to update in dotted notationval
- the new value (converted to simple type)- Returns:
- the changes applied to the config
-
update
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
-