Hi Romain
/Mark
around your proposal my feedback:
Filter {
boolean supports(key, value);
String filter(key, value);
}
- 2 methods for something easy like value filtering, IMO too much! The
supports method does not add any additional functionality I cannot do
within filter itself
- There is a very good reason, why there is also a Function coming in the
API: it gives the filter
access to the original unfiltered set of properties for
- accessing metadata about the property to filter
- to see if in case of a null value read out the original value and maybe
readding a filtered version of it
- evaluate further properties
Since the time of filtering is a special runtime state within evaluating
configuration it is not possible to route the call simply to the normal
configuration methods (it would loop). Additionally original unfiltered
values are not present.
So -100 to remove it. Summairzing IMO the filter looks exact how it should,
no more no less.
Cheers
Anatole
2015-01-06 12:16 GMT+01:00 Romain Manni-Bucau <[email protected]>:
> 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
>
--
*Anatole Tresch*
Java Engineer & Architect, JSR Spec Lead
Glärnischweg 10
CH - 8620 Wetzikon
*Switzerland, Europe Zurich, GMT+1*
*Twitter: @atsticks*
*Blogs: **http://javaremarkables.blogspot.ch/
<http://javaremarkables.blogspot.ch/>*
*Google: atsticksMobile +41-76 344 62 79 <%2B41-76%20344%2062%2079>*