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

properties-binding: support binding from maps of maps

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    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

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              lb Luca Burgazzoli

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment