Friday, 15 July 2011

groovy - How to solve grails print method name conflict -



groovy - How to solve grails print method name conflict -

i have code in grails

datetimeformatter formatter = datetimeformat.forpattern("yyyy-mm-dd hh:mm"); formatter.print(new datetime()) // it's null formatter.with{ delegate.invokemethod('print', new datetime()) } // it's null invokerhelper.invokemethod(formatter, 'print', new datetime()) //it's null

i found grails invokes "invokepojomethod" method, , metaclass expandometaclass, contains 'print' method

static object invokepojomethod(object object, string methodname, object arguments) { metaclass metaclass = invokerhelper.getmetaclass(object); homecoming metaclass.invokemethod(object, methodname, asarray(arguments)); }

how invoke joda's datetimeformatter method 'print' straight , solve name conflict?

grails groovy

No comments:

Post a Comment