Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-15437

properties-binding: support binding from maps of maps

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 3.5.0
    • camel-core
    • None
    • Unknown

    Description

      The properties binding component now support flat properties onlyso if oyu need to bind nesting object, you need to use an OGNL like syntax but it would be nice to support also "map of maps" as example to do the binding from as example JSON.

      Assuming we have a class like:

      class Bar {
          String name;
      }
      
      class Foo {
          Bar bar;
      }
      

      The it would be nice if we can bind from map like:

      Map<Object, Object> properties = Map.of(
          Map.of(
              "bar",
              Map.of("name", "test")
          )
      );
      

      Then one could use PropertyBindingSupport as usual:

      Foo target = new Foo();
      
      PropertyBindingSupport.build()
          .withCamelContext(context)
          .withTarget(target)
          .withProperties(properties)
          .withRemoveParameters(false)
          .bind();
      

      The same copde using flat properties would look like:

      Foo target = new Foo();
      
      PropertyBindingSupport.build()
          .withCamelContext(context)
          .withTarget(target)
          .withProperties("bar.name", "test")
          .withRemoveParameters(false)
          .bind();
      

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              lb Luca Burgazzoli
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: