Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-4034

Instance configuration DSL

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • ipojo-runtime-1.10
    • iPOJO
    • None

    Description

      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.

      Attachments

        Activity

          People

            clement.escoffier Clement Escoffier
            clement.escoffier Clement Escoffier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: