You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2016/11/10 18:13:58 UTC

[jira] [Created] (FELIX-5406) DM lambda fluent service properties don't support dots

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)