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

properties-binding: support binding from maps of maps

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.5.0
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: