You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Clement Escoffier (JIRA)" <ji...@apache.org> on 2013/04/24 16:59:15 UTC

[jira] [Created] (FELIX-4034) Instance configuration DSL

Clement Escoffier created FELIX-4034:
----------------------------------------

             Summary: Instance configuration DSL
                 Key: FELIX-4034
                 URL: https://issues.apache.org/jira/browse/FELIX-4034
             Project: Felix
          Issue Type: New Feature
          Components: iPOJO
            Reporter: Clement Escoffier
            Assignee: Clement Escoffier
             Fix For: ipojo-runtime-1.10


Provides a DSL to declare instances without relying on XML.

This DSL looks like a fluent API using in classes annotated with the @Configuration annotation:

@Configuration
public class MyInstances {
        Instance i1 = instance().of("my.factory")
                .with("simple").setto("simple");

        Instance i2 = instance()
                .of("my.factory")
                .with("simple").setto("simple")

                .with("list").setto(list(1, 2, 3))
                .with("list2").setto(list().with(1).with(2).with(3))

                .with("map").setto(map().with(pair("entry", "value")))
                .with("map").setto(map()
                .with(pair("entry2", list("aaa", "bbb"))));
}

Methods returning instances should also be called (receiving an optional bundle context). Thus we can add some logic computing the instance configuration.

The DSL creates an instance declaration and not just an instance. It's equivalent to the <instance/> XML declaration. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira