I create Groovy objects using this convention...
Item item1 = new Item( name: "foo", weight: "150")
...is there a shorthand convention for manipulating properties object? something like this...
item1( name: "hello", weight: "175") //this does not work, btw ;-)
...instead of...
item1.name = "hello"
item1.weight = "175"
I prefer item1.with if I have concrete variables to change
I prefer InvokerHelper.setProperties when I have map of properties (can be any size)
Output:
You have the
with
method, as described by the great Mr HakiYes, you can do it like this: