Current approach does not give Config implementation enough information to optimize access to property values - these can never be cached, as each config source may be unscannable and may not inform about changes.
To support this, we should be able to obtain these attributes of a config source:
Mutability: can this config source change its values?
Scannability: can this config source list the keys (and maybe values) provided by it?
Change support: can this config source consistently notify of changed keys/values?
In the pull request, the problems are solved as follows:
Mutability: you can return ChangeSupport.IMMUTABLE when config sets the change callback
Scannability: methods getProperties() and getPropertyNames() now return Optional. If empty, this source is not scannable
Change support: you can return either of ConfigSource.ChangeSupport enum values when config sets callback to inform config about your source behavior. The options are:
SUPPORTED: This config source is mutable and supports callback
UNSUPPORTED: This config source is mutable and does not support callback
IMMUTABLE: This config source is immutable, changes never happen
Current approach does not give Config implementation enough information to optimize access to property values - these can never be cached, as each config source may be unscannable and may not inform about changes. To support this, we should be able to obtain these attributes of a config source: