Project: mule
Issue MULE-8210: Support parameter grouping in Configurations and Operations
There are cases in which a group of parameters are frequently used together, for which it makes sense to treat them as a group. The extensions api already supports mapping pojos directly in the XML, but in same cases which group is preferred as parameters rather than a top level object. To enable that, the @Parameters operation will be created {code:java} @Extension public class MyExtension { @Parameters private Options options; } public class Options { @Parameter private String color; @Parameter @Optional private String mode; private String owner; } } {code} The outcome of the code above is a configuration with two parameters called 'color' and 'mode', one required and the other optional. The configuration has no attribute called options. If the Options class were to have another field also annotated with @Parameters, then such fields will be ignored. In the same way, the annotation can be applied to a class holding operations: {code:java} public class Operations { @Parameters private Options options; @Operation public void hello(String message) { ... } @Operation public void goodBye(String message) { } } {code} In this case, both operations will have three parameters: message, color and mode. The last use case for this annotation is to have nested parameter classes: {code:java} public class Options { @Parameter private String color; @Parameter @Optional private String mode; @Parameters private MoreOptions moreOptions; } } {code} In this last example, the configuration/operation that is augmented with this extra parameters will have the sum of Options and MoreOptions parameters. Those parameters will be flattened, meaning that the model will contain no reference to the fact that the MoreOptions parameters were nested inside Options. The field must be a Java bean property (ie it needs to have setters and getters matching the field name).
Story points: 8