polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Merlin <paulmer...@apache.org>
Subject Re: Configuration structure
Date Sun, 04 Jun 2017 11:01:56 GMT
Maybe a silly idea, don't know, totally different, but ...

interface MyConfig {

   @UseDefaults( value = "user.home", source = 
   Property<String> homeDirectoryPath();

   @UseDefaults( value = "SOME_PORT", source = DefaultsSource.ENVIRONMENT 
   Property<Integer> thePortWeWantToUse();

   Property<List<String>> somethingElse();


Too much annotations, erk ...

Looking at it this way the goal could be seen as providing default 
values per property.

We already have the assembly time initial value provider that can do 
just that, or could be enhanced to (couldn't find tests for it ...). We 
could then provide some helpers for system properties / environment 
variables mapping.

BTW, shouldn't InitialValueProvider be named DefaultValueProvider 
instead, for consistency?

View raw message