Search code examples
grailsgroovygrails-ormgrails-domain-class

Get all transient fields of class


How can i get all transient fields of domain class?

I need smth like this:

domainObject.domainClass.persistentProperties

but for transient properties.


Solution

  • domainObject.domainClass.properties returns a list of DefaultGrailsDomainClassProperty. These objects have a number of properties themselves, including persistent.

    You can find all transient properties with:

    domainObject.domainClass.properties.findAll { !it.persistent }