To make it more clear how we envisioned the PropertyAdaptors to work:

E.g. we have Configuration.current().get("mykey", Boolean.class);
This would result in the following steps

1.) look up 'mykey' in all PropertySources.
2.) if nothing was found (val == null || null.isEmpty()) -> return null; and we 
are done
3.) if something was found -> try to convert. Iterate over all PropertyAdaptors 
until one of them could convert it
4.) if the value could not get converted -> ask all PropertyAdaptors which 
format they support and log an error or throw an Exception even?

LieGrue,
strub 




> On Wednesday, 21 January 2015, 16:45, Mark Struberg <[email protected]> wrote:
> > +1 please revert. This is a kind of fall-through loop. And only if none of 
> > the 
> PropertyAdapters knows the format we need to log some warning.
> 
> LieGrue,
> strub
> 
> 
> 
> 
>>  On Wednesday, 21 January 2015, 14:29, Anatole Tresch 
> <[email protected]> wrote:
>>  >T his is not a valid change. There might be other converters in the 
> chain that 
>>  will never be executed if returning a non null result! So returning null is 
> a 
>>  must.
>> 
>>  -
>>  Anatole Tresch
>>  Glärnischweg 10
>>  8620 Wetzikon
>>  Tel +41 (43) 317 05 30
>>  -
>>  Send from Mobile
>> 
>> 
>>>   Am 21.01.2015 um 01:58 schrieb [email protected]:
>>> 
>>>   Repository: incubator-tamaya
>>>   Updated Branches:
>>>    refs/heads/master 166f30b6b -> 2ce460db0
>>> 
>>> 
>>>   BooleanConverter returns now false if it is not able to identify the 
> value 
>>  als true ;-)
>>> 
>>> 
>>>   Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
>>>   Commit: 
>>  http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/2ce460db
>>>   Tree: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/2ce460db
>>>   Diff: 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/2ce460db
>>> 
>>>   Branch: refs/heads/master
>>>   Commit: 2ce460db0752d8c29f8e20c2fa1dfb6c58640f95
>>>   Parents: 166f30b
>>>   Author: Oliver B. Fischer <[email protected]>
>>>   Authored: Wed Jan 21 01:57:20 2015 +0100
>>>   Committer: Oliver B. Fischer <[email protected]>
>>>   Committed: Wed Jan 21 01:57:20 2015 +0100
>>> 
>>>   ----------------------------------------------------------------------
>>>   .../apache/tamaya/core/internal/converters/BooleanConverter.java   | 2 
> +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>   ----------------------------------------------------------------------
>>> 
>>> 
>>> 
>> 
> http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/2ce460db/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   ----------------------------------------------------------------------
>>>   diff --git 
>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>  
> 
>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   index 3533f47..b309631 100644
>>>   --- 
>> 
> a/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   +++ 
>> 
> b/java8/core/src/main/java/org/apache/tamaya/core/internal/converters/BooleanConverter.java
>>>   @@ -47,6 +47,6 @@ public class BooleanConverter implements 
>>  PropertyConverter<Boolean> {
>>>               default:
>>>                   LOG.warning("Unknown boolean value encountered: 
> " 
>>  + value);
>>>           }
>>>   -        return null;
>>>   +        return Boolean.FALSE;
>>>       }
>>>   }
>>> 
>> 
>

Reply via email to