- java.lang.Object
-
- io.helidon.config.AbstractSource
-
- io.helidon.config.AbstractConfigSource
-
- io.helidon.config.MapConfigSource
-
- All Implemented Interfaces:
ConfigSource,NodeConfigSource,PollableSource<Map<?,?>>,Source,Supplier<ConfigSource>
- Direct Known Subclasses:
ConfigSources.SystemPropertiesConfigSource
public class MapConfigSource extends AbstractConfigSource implements ConfigSource, NodeConfigSource, PollableSource<Map<?,?>>
ConfigSourceimplementation based onMap<String, String>.Map key format must conform to
Config keyformat.- See Also:
MapConfigSource.Builder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapConfigSource.BuilderFluent API builder forMapConfigSource.static classMapConfigSource.MapBuilder<T extends MapConfigSource.MapBuilder<T>>An abstract fluent API builder forMapConfigSource.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MapConfigSource.Builderbuilder()Create a new fluent API builder.static MapConfigSourcecreate(Map<String,String> map)Create a new config source from the provided map.static MapConfigSourcecreate(Properties properties)Create a new config source from the provided properties.booleanisModified(Map<?,?> stamp)This method is invoked to check if this source has changed.Optional<ConfigContent.NodeContent>load()Loads the underlying source data.Optional<PollingStrategy>pollingStrategy()A polling strategy of this source, if it implementsPollableSourceand has one configured.protected Stringuid()Returns universal id of source to be used to constructAbstractSource.description().-
Methods inherited from class io.helidon.config.AbstractConfigSource
mediaType, parser, toString
-
Methods inherited from class io.helidon.config.AbstractSource
changeWatcher, description, optional, retryPolicy
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.helidon.config.spi.ConfigSource
get, init
-
Methods inherited from interface io.helidon.config.spi.Source
description, exists, optional, retryPolicy
-
-
-
-
Method Detail
-
builder
public static MapConfigSource.Builder builder()
Create a new fluent API builder.- Returns:
- a new builder instance
-
create
public static MapConfigSource create(Map<String,String> map)
Create a new config source from the provided map.- Parameters:
map- config properties- Returns:
- a new map config source
-
create
public static MapConfigSource create(Properties properties)
Create a new config source from the provided properties.- Parameters:
properties- properties to serve as source of data- Returns:
- a new map config source
-
isModified
public boolean isModified(Map<?,?> stamp)
Description copied from interface:PollableSourceThis method is invoked to check if this source has changed.- Specified by:
isModifiedin interfacePollableSource<Map<?,?>>- Parameters:
stamp- the stamp of the last loaded content- Returns:
trueif the current data of this config source differ from the loaded data, including cases when the source has disappeared
-
pollingStrategy
public Optional<PollingStrategy> pollingStrategy()
Description copied from class:AbstractSourceA polling strategy of this source, if it implementsPollableSourceand has one configured.- Specified by:
pollingStrategyin interfacePollableSource<Map<?,?>>- Overrides:
pollingStrategyin classAbstractSource- Returns:
- polling strategy if any configured
-
load
public Optional<ConfigContent.NodeContent> load() throws ConfigException
Description copied from interface:NodeConfigSourceLoads the underlying source data. This method is only called when the sourceSource.exists().The method can be invoked repeatedly, for example during retries.
- Specified by:
loadin interfaceNodeConfigSource- Returns:
- An instance of
Tas read from the underlying origin of the data (if it exists) - Throws:
ConfigException- in case of errors loading from the underlying origin
-
uid
protected String uid()
Description copied from class:AbstractSourceReturns universal id of source to be used to constructAbstractSource.description().- Overrides:
uidin classAbstractSource- Returns:
- universal id of source
-
-