Groovy - Ignore extra attributes in a map during object instantiation
问题 Is there a way to make groovy ignore extra attributes in a map during object instantiation? Example: class Banana{ String name } def params = [name:'someGuy', age:13] new Banana(params) In this example, groovy throws a No such property: age exception (obviously because age isn't defined in the Banana class. Without resorting to manually mapping only the desired attributes from the map to the constructor of the Banana class, is there a way to tell Banana to ignore the extra attributes? I