Created
May 22, 2014 14:43
-
-
Save int128/af097d5d5a82bc6dd4b6 to your computer and use it in GitHub Desktop.
Adding static property on runtime
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
@groovy.transform.ToString | |
class A { | |
//static final int P = 100 | |
int x | |
} | |
A.metaClass.P = 100 | |
def a = new A() | |
a.with { | |
x = P | |
} | |
a // -> A(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment