Package io.bdeploy.common.cfg
Class Configuration
java.lang.Object
io.bdeploy.common.cfg.Configuration
The
Configuration is basically a wrapper around a Map which
exposes access to the Map through Annotations.
Any arbitrary Annotation can be defined, including default values,
and mapped to the Configuration using get(Class).
The mapped Annotation will access the underlying Map on every
method call. If a key exists in the Map that corresponds to the name
of the Annotation's Method, it will be converted to the
target type and returned. Otherwise the default value of the Method
is returned.
There is (limited) type conversion capabilities. Mainly this functionality
exists to be able to map Strings (e.g. when mapping a command line
using add(String...)) to the target types of the Annotation
Methods.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceMaps the annotated method to another property name in the context.static @interfaceAnnotated field's value will be mapped on injection using the givenConfiguration.ValueMappingpolicy.static interfacestatic @interfacestatic @interfacestatic @interfacestatic @interfacestatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a set of command line arguments to the mapping.voidadd(Properties properties) Adds arbitrary (String) properties to the mapping.static <T> Tstatic voidformatHelp(Class<? extends Annotation> cfg, DataTable target) AnalyzeConfiguration.Helpannotations on the targetAnnotationand print out help information on the givenPrintStream.<T extends Annotation>
Tget(Class<? extends Annotation> target) Returns an instance of the givenAnnotation, mapping eachMethodto a value in the mapping where theMethodname is the key into the wrappedMap.
-
Constructor Details
-
Configuration
public Configuration()
-
-
Method Details
-
add
Add a set of command line arguments to the mapping. Arguments must currently start with '--'.- Parameters:
arguments- the command line argument as passed to the program.
-
getAllRawObjects
-
add
Adds arbitrary (String) properties to the mapping.Typically used to add a configuration file or system properties to the mapping
- Parameters:
properties- the entries to add to the mapping.
-
get
Returns an instance of the givenAnnotation, mapping eachMethodto a value in the mapping where theMethodname is the key into the wrappedMap.- Parameters:
target- theClassto map thisConfigurationto.- Returns:
- a proxy mapping to the
Configuration.
-
cast
-
formatHelp
AnalyzeConfiguration.Helpannotations on the targetAnnotationand print out help information on the givenPrintStream.
-