Instantiating Groovy class within Java class -
i have groovy class
@immutable class statuscode { final int statuscode }
i want create object of class in java class say, test.java. when use,
public class test{ statuscode statuscode; public void setstatuscode(int statuscode) { this.statuscode = new statuscode(statuscode); } }
it says constructor missing. how instantiate object ?
groovy code can compiled java bytecode using groovyc. give valid java class can reference other java class. still need have groovy runtime jar on claspath.
it's possible groovy compiler generate desired constructor you, i'm not sure. if not, you'd need explicitly code in groovy class.
Comments
Post a Comment