According to Camel’s doc the Bean component has a parameters query parameter. Now, with a class
class MyBean implements Supplier<Object> {
String id;
MyBean( final String id ) {
this.id = id;
}
MyBean setId( final String id ) {
this.id = id;
return this;
}
@Override
@Handler
public void accept(Object o) {
// ...
}
is it possible to do something like
- setting attributes with an associative array or a Map:
String[] attributes = { "id", "My bean's id.", "attr2", "value2", ... };
.bean( MyBean.class, attributes )
.bean( MyBean.class, Map.of( "id", "My bean's id.", "attr2", "value2", ... ) )
- or via (positional) constructor parameters:
.bean( MyBean.class, { "MyBean()", "My bean's id." } )
- or by invoking methods:
.bean( MyBean.class, { "setId("My bean's id.")" } )
- or with URIs:
.from( "bean:MyBean?id="My bean's id."&ctorArgs="My bean's id."&method=setId("My bean's id.")" )