We've had this discussion many times. The first task of a specification is to 
specify to enable interoperability. That is, it is not about convenience. Once 
you have the interoperability, anybody can create convenience functions; it is 
then up to the users to standardize on a few libraries.

The reason is that 

- One man's convenience is another man's bloat. An
- Specifying costs a lot of effort, a lot easier to do this stuff in an open 
source project

Then I was wondering why I did not have this issue lately? I realized that I 
always use DS and get a Map that I convert to an interface:

        interface Props {
                int port();
                List<String> hosts();
        }

        void setFoo(Foo foo, Map<String,Object> props) {
                Props props = Converter.cnv(Props.class,props);
                ...
        }

The Converter I used is quite powerful, it really converts anything to anything 
it could make sense. This converter is in bnd (aQute.libg). I even catch myself 
converting e.g. List<String> to List<Long> because it beats looping. It makes 
extensive use of the generic type information. So I rarely care what the actual 
types are in the properties. 

Kind regards,

        Peter Kriens







On 7 feb. 2014, at 17:00, Raymond Auge <[email protected]> wrote:

> Hello All,
> 
> I was wondering if there were provided utilities for handling the property 
> types.
> 
> For instance, string+, arrays of primitives, etc?
> 
> I hate rewriting things if they already exist. However, I don't see anything 
> either in the core or compendium, but it seems rather sad if we all have to 
> reproduce such handler code.
> 
> -- 
> Raymond Augé (@rotty3000)
> Senior Software Architect
> Liferay, Inc. (@Liferay)
> 
> 
> 
> 
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to