@Mark: this works as well but all impl will basically be:
if (support()) { return compute(); } else return input;
expliciting support can make it clearer but nothing against null or
input as "not handled" returned value.
Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau
2015-01-06 13:33 GMT+01:00 Mark Struberg <[email protected]>:
> +1 for removing the Function. I don't understand what it is supposed to do
> neither.
>
>
> And imo we don't even need the supports(method). If a Filter doesn't support
> the key/value then it simply doesn't change the value and just returns it 1:1.
>
> LieGrue,
> strub
>
>
>
>
>
>> On Tuesday, 6 January 2015, 12:19, Romain Manni-Bucau
>> <[email protected]> wrote:
>> > Hi guys,
>>
>> just notice filter API was:
>>
>> String filterProperty(String key, String valueToBeFiltered,
>> Function<String,String> propertyValueProvider);
>>
>> I dont get it at all:
>> 1) if forces a returned value -> I'd add a supports(key, currentValue)
>> to make filter composition easier
>> 2) why a function? a filter needs key and value not only one of both +
>> why doing a function (filterProperty) of function since we dont need
>> it for something as trivial as filtering. If you want to play with
>> java 8 then org.apache.tamaya.core.internal.DefaultConfiguration#get(String)
>> should get a list of fnuction to apply but it would be a very weird
>> API.
>>
>> My Proposal would be simply:
>>
>> Filter {
>> boolean supports(key, value);
>> String filter(key, value);
>> }
>>
>>
>> wdyt?
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>