Grails 3 and grails.validateable.classes

78 views
Skip to first unread message

Jeff Scott Brown

unread,
Aug 8, 2014, 10:56:11 AM8/8/14
to grails-de...@googlegroups.com
For Grails 3 I have been surveying a lot of the places where Grails does runtime metaprogramming and have been replacing a lot of that with compile time work or use of Groovy’s extension api support.  One situation we have is the way we support grails.validateable.classes.  Grails allows you to do something like this in Config.groovy:

grails.validateable.classes = [com.mycompany.myapp.User, com.mycompany.dto.Account]

Those classes are made validateable using runtime metaprogramming.  I think the primary reason for taking advantage of that is if those classes are included in some library and you can’t mark them with @Validateable.  I expect that feature is not very widely used. I think we should remove the code from Grails 3 which supports that.  A plugin which adds that support back to the app would be trivial to build but I think it is a small bit of cruft in core that probably isn’t justified.

Thoughts?



JSB

--
Jeff Scott Brown
jbr...@pivotal.io

Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

Peter Ledbrook

unread,
Aug 19, 2014, 6:11:07 AM8/19/14
to grails-de...@googlegroups.com
On 8 August 2014 15:56, Jeff Scott Brown <jbr...@pivotal.io> wrote:
> For Grails 3 I have been surveying a lot of the places where Grails does runtime metaprogramming and have been replacing a lot of that with compile time work or use of Groovy’s extension api support. One situation we have is the way we support grails.validateable.classes. Grails allows you to do something like this in Config.groovy:
>
> grails.validateable.classes = [com.mycompany.myapp.User, com.mycompany.dto.Account]
>
> Those classes are made validateable using runtime metaprogramming. I think the primary reason for taking advantage of that is if those classes are included in some library and you can’t mark them with @Validateable. I expect that feature is not very widely used. I think we should remove the code from Grails 3 which supports that. A plugin which adds that support back to the app would be trivial to build but I think it is a small bit of cruft in core that probably isn’t justified.
>
> Thoughts?

Do it. I think consistency of behaviour is best here. That said, it
would be useful if developers have some way of making classes outside
of their control validateable, even if it requires some work on their
part. I wonder if the @Delegate annotation is a viable option here.

Peter

--
Peter Ledbrook
t: @pledbrook
w: http://www.cacoethes.co.uk/
Reply all
Reply to author
Forward
0 new messages