Module io.inverno.mod.configuration
Class CommandLineConfigurationSource
java.lang.Object
io.inverno.mod.configuration.AbstractConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<String,CommandLineConfigurationSource>,AbstractHashConfigurationSource.HashExecutableConfigurationQuery<String,CommandLineConfigurationSource>,AbstractHashConfigurationSource.HashListConfigurationQuery<String,CommandLineConfigurationSource>,String>
io.inverno.mod.configuration.AbstractHashConfigurationSource<String,CommandLineConfigurationSource>
io.inverno.mod.configuration.source.CommandLineConfigurationSource
- All Implemented Interfaces:
ConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<String,
,CommandLineConfigurationSource>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<String, CommandLineConfigurationSource>, AbstractHashConfigurationSource.HashListConfigurationQuery<String, CommandLineConfigurationSource>> DefaultableConfigurationSource<AbstractHashConfigurationSource.HashConfigurationQuery<String,
CommandLineConfigurationSource>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<String, CommandLineConfigurationSource>, AbstractHashConfigurationSource.HashListConfigurationQuery<String, CommandLineConfigurationSource>, CommandLineConfigurationSource>
public class CommandLineConfigurationSource
extends AbstractHashConfigurationSource<String,CommandLineConfigurationSource>
A configuration source that looks up properties from command line arguments.
Configuration properties are specified as application arguments using the following syntax (ABNF):
argument = "--" {@literal property_name} [ "[" *(parameter ",") "]" ] "=" property_value
property_name = java_name
property_value = java_integer_literal
/ java_floating_point_literal
/ java_string_literal
/ java_boolean_literal
/ "unset"
/ "null"
parameter = parameter_name "=" parameter_value
parameter_name = java_identifier
parameter_value = java_integer_literal
/ java_floating_point_literal
/ java_string_literal
/ java_boolean_literal
The following are valid configuration properties passed as command line arguments:
--web.server_port=8080
--web.server_port[profile="ssl"]=8443
--db.url[env="dev"]="jdbc:oracle:thin:@dev.db.server:1521:sid"
--db.url[env="prod",zone="eu"]="jdbc:oracle:thin:@prod_eu.db.server:1521:sid"
--db.url[env="prod",zone="us"]="jdbc:oracle:thin:@prod_us.db.server:1521:sid"
- Since:
- 1.0
- Author:
- Jeremy Kuhn
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.inverno.mod.configuration.AbstractHashConfigurationSource
AbstractHashConfigurationSource.HashConfigurationQuery<A,
B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashConfigurationQueryResult<A, B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashExecutableConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>>, AbstractHashConfigurationSource.HashListConfigurationQuery<A, B extends AbstractHashConfigurationSource<A, B>> -
Field Summary
Fields inherited from class io.inverno.mod.configuration.AbstractHashConfigurationSource
defaultingStrategy, initial
Fields inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
decoder
-
Constructor Summary
ConstructorDescriptionCommandLineConfigurationSource
(String[] args) Creates a command line configuration source with the specified arguments using a Java String value decoder.CommandLineConfigurationSource
(String[] args, SplittablePrimitiveDecoder<String> decoder) Creates a command line configuration source with the specified arguments and the specified string value decoder. -
Method Summary
Modifier and TypeMethodDescriptionprotected Mono
<List<ConfigurationProperty>> load()
Loads the configuration properties.withDefaultingStrategy
(DefaultingStrategy defaultingStrategy) Returns a proxy of the defaultable configuration source instance using the specified defaulting strategy.Methods inherited from class io.inverno.mod.configuration.AbstractHashConfigurationSource
get, list, unwrap
Methods inherited from class io.inverno.mod.configuration.AbstractConfigurationSource
getDecoder, setDecoder
-
Constructor Details
-
CommandLineConfigurationSource
Creates a command line configuration source with the specified arguments using a Java String value decoder.
- Parameters:
args
- the command line arguments
-
CommandLineConfigurationSource
Creates a command line configuration source with the specified arguments and the specified string value decoder.
- Parameters:
args
- the command line argumentsdecoder
- a string decoder
-
-
Method Details
-
withDefaultingStrategy
Description copied from interface:DefaultableConfigurationSource
Returns a proxy of the defaultable configuration source instance using the specified defaulting strategy.
- Parameters:
defaultingStrategy
- a defaulting strategy- Returns:
- a new defaultable configuration source
-
load
Description copied from class:AbstractHashConfigurationSource
Loads the configuration properties.
- Specified by:
load
in classAbstractHashConfigurationSource<String,
CommandLineConfigurationSource> - Returns:
- A mono emitting the list of configuration properties
-