Created
April 4, 2012 12:46
-
-
Save purplefox/2300852 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
It's nice being able to set properties by passing them to the constructor in Groovy: | |
def foo = new Foo(bar: 23, wibble: "hello") | |
But if Foo is created via a factory method instead: | |
def foo = Foo.createFoo(bar: 23, wibble: "hello") | |
It doesn't work | |
where | |
class Foo { | |
.. properties | |
static Foo createFoo() { | |
return new Foo(); | |
} | |
} | |
How can I get this to work with factories? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK, I finally understand. You're right, you can't get automatic property binding once you're no longer using the default constructor. I've been told it may be worth a JIRA :)