felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre De Rop (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-5406) DM lambda fluent service properties don't support dots
Date Thu, 10 Nov 2016 18:13:58 GMT
Pierre De Rop created FELIX-5406:
------------------------------------

             Summary: DM lambda fluent service properties don't support dots
                 Key: FELIX-5406
                 URL: https://issues.apache.org/jira/browse/FELIX-5406
             Project: Felix
          Issue Type: Improvement
            Reporter: Pierre De Rop
            Assignee: Pierre De Rop
            Priority: Minor


With dm-lambda, you can't define service properties with dots when you use fluent service
properties using lambda expressions.

For example, you can declare this component which provides a service using the "foo=bar" service
property:

{code}
component(comp ->comp
    .impl(ServiceImpl.class)
    .provides(Service.class, foo -> "bar"))          
{code}

but you can't use dots in the service property name (like "foo.bar=zoo"):

{code}
component(comp -> comp
    .impl(ServiceImpl.class)
    .provides(Service.class, foo.bar -> "zoo"))  
{code}

Indeed, a lambda parameter name can't contain any dots. A convention can be used like in OSGi
metatype, where underscore can be used to convert dots, and a double underscore is then converted
to a single underscore, like this:

{code}
component(comp -> comp
    .impl(ServiceImpl.class)
    .provides(Service.class, foo_bar -> "zoo", foo__bar -> "zoo2"));
{code}

In the above example, foo_bar is then mapped to "foo.bar" service property name and foo__bar
is then mapped to foo_bar property name.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message