Search code examples
grailsgrails-ormgrails-domain-classgrails3

Accessing static mapping content on Grails Domain class from gsp


Given a basic domain class

class WorkOrderStatus {
    String status 
    static mapping = {
        sort status: 'desc'
    }
}

How can I access in a GSP page or controller the values in that static mapping block?

Thanks!


Solution

  • Found this excellent post to explain how to do it. This code (using the class in the article) produces the desired results.

    ClosureInterrogator.extractValuesFromClosure(domainClass.clazz.mapping)