- java.lang.Object
-
- io.helidon.config.ConfigSources
-
public final class ConfigSources extends Object
Provides access to built-inConfigSourceimplementations.- See Also:
ConfigSource
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classConfigSources.SystemPropertiesConfigSourceSystem properties config source.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ClasspathConfigSource.Builderclasspath(String resource)Provides aBuilderfor creating aConfigSourcefrom the specified resource located on the classpath of the current thread's context classloader.static List<UrlConfigSource.Builder>classpathAll(String resource)Create builders for each instance of the resource on the current classpath.static ConfigSourcecreate(Config config)Returns aConfigSourcethat contains the same configuration model as the providedconfig.static NodeConfigSourcecreate(ConfigNode.ObjectNode objectNode)Returns aConfigSourcethat wraps the specifiedobjectNode.static ConfigSourcecreate(InputStream data, String mediaType)static ConfigSourcecreate(String content, String mediaType)static MapConfigSource.Buildercreate(Map<String,String> map)static MapConfigSource.Buildercreate(Map<String,String> map, String name)static MapConfigSource.Buildercreate(Properties properties)static MapConfigSource.Buildercreate(Properties properties, String name)static DirectoryConfigSource.Builderdirectory(String path)Provides aBuilderfor creating aConfigSourcefrom the specified directory path.static ConfigSourceempty()Provides an empty config source.static MapConfigSourceenvironmentVariables()Provides a @{code ConfigSource} for creating aConfigfrom environment variables.static FileConfigSource.Builderfile(String path)Provides aBuilderfor creating aConfigSourcefrom the specified file path.static FileConfigSource.Builderfile(Path path)Provides aBuilderfor creating aConfigSourcefrom the specified file path.static ConfigSourceprefixed(String key, Supplier<? extends ConfigSource> sourceSupplier)Provides aConfigSourcefrom asourceSupplier, adding the specifiedprefixto the keys in the source.static ConfigSources.SystemPropertiesConfigSource.BuildersystemProperties()Provides aConfigSourcefor creating aConfigderived from system properties.static UrlConfigSource.Builderurl(URL url)Provides aBuilderfor creating aConfigSourcefrom the specified URL.
-
-
-
Method Detail
-
empty
public static ConfigSource empty()
Provides an empty config source.- Returns:
- empty config source
-
create
public static ConfigSource create(Config config)
Returns aConfigSourcethat contains the same configuration model as the providedconfig.- Parameters:
config- the originalConfig- Returns:
ConfigSourcefor the sameConfigas the original
-
create
public static NodeConfigSource create(ConfigNode.ObjectNode objectNode)
Returns aConfigSourcethat wraps the specifiedobjectNode.- Parameters:
objectNode- hierarchical configuration representation that will be returned by the created config source- Returns:
- new instance of
ConfigSource - See Also:
ConfigNode.ObjectNode,ConfigNode.ListNode,ConfigNode.ValueNode,ConfigNode.ObjectNode.Builder,ConfigNode.ListNode.Builder
-
create
public static ConfigSource create(InputStream data, String mediaType)
Provides aConfigSourcefrom the providedreadable contentand with the specifiedmediaType.Instant.now()is thecontent timestamp.- Parameters:
data- aInputStreamproviding the configuration contentmediaType- a configuration media type- Returns:
- a config source
-
create
public static ConfigSource create(String content, String mediaType)
Provides aConfigSourcefrom the providedStringcontent and with the specifiedmediaType.Instant.now()is thecontent timestamp.- Parameters:
content- a configuration contentmediaType- a configuration media type- Returns:
- a config source
-
create
public static MapConfigSource.Builder create(Map<String,String> map)
- Parameters:
map- a map- Returns:
- new Builder instance
- See Also:
create(Properties)
-
create
public static MapConfigSource.Builder create(Map<String,String> map, String name)
- Parameters:
map- a mapname- the name.- Returns:
- new Builder instance
- See Also:
create(Properties)
-
create
public static MapConfigSource.Builder create(Properties properties)
- Parameters:
properties- properties- Returns:
- new Builder instance
- See Also:
create(Map)
-
create
public static MapConfigSource.Builder create(Properties properties, String name)
- Parameters:
properties- propertiesname- the name.- Returns:
- new Builder instance
- See Also:
create(Map)
-
prefixed
public static ConfigSource prefixed(String key, Supplier<? extends ConfigSource> sourceSupplier)
Provides aConfigSourcefrom asourceSupplier, adding the specifiedprefixto the keys in the source.- Parameters:
key- key prefix to be added to all keyssourceSupplier- a config source supplier- Returns:
- new @{code ConfigSource} for the newly-prefixed content
-
systemProperties
public static ConfigSources.SystemPropertiesConfigSource.Builder systemProperties()
Provides aConfigSourcefor creating aConfigderived from system properties.- Returns:
ConfigSourcefor config derived from system properties
-
environmentVariables
public static MapConfigSource environmentVariables()
Provides a @{code ConfigSource} for creating aConfigfrom environment variables.- Returns:
ConfigSourcefor config derived from environment variables
-
classpath
public static ClasspathConfigSource.Builder classpath(String resource)
Provides aBuilderfor creating aConfigSourcefrom the specified resource located on the classpath of the current thread's context classloader.The name of a resource is a '
/'-separated full path name that identifies the resource. If the resource name has a leading slash then it is dropped before lookup.- Parameters:
resource- a name of the resource- Returns:
- builder for a
ConfigSourcefor the classpath-based resource
-
classpathAll
public static List<UrlConfigSource.Builder> classpathAll(String resource)
Create builders for each instance of the resource on the current classpath.- Parameters:
resource- resource to look for- Returns:
- a list of classpath config source builders
-
file
public static FileConfigSource.Builder file(String path)
Provides aBuilderfor creating aConfigSourcefrom the specified file path.- Parameters:
path- a file path- Returns:
- builder for the file-based
ConfigSource
-
file
public static FileConfigSource.Builder file(Path path)
Provides aBuilderfor creating aConfigSourcefrom the specified file path.- Parameters:
path- a file path- Returns:
- builder for the file-based
ConfigSource
-
directory
public static DirectoryConfigSource.Builder directory(String path)
Provides aBuilderfor creating aConfigSourcefrom the specified directory path.- Parameters:
path- a directory path- Returns:
- new Builder instance
-
url
public static UrlConfigSource.Builder url(URL url)
Provides aBuilderfor creating aConfigSourcefrom the specified URL.- Parameters:
url- a URL with configuration- Returns:
- new Builder instance
- See Also:
url(URL)
-
-