|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.grails.plugin.vaadin.data.DomainPropertyDescriptor
class DomainPropertyDescriptor
A property descriptor that allows properties nested to arbitrary depth for a domain class.
For example, for domain class Book, you could have property
author.sister.husband.address.street
Also allows separate properties to hold a common map of all changed properties
for the domain instance. When each property sets its value on the domain instance,
it calls domainInstance.properties = changedProperties
.
This ensures that spring errors are not lost for other properties, whenever we set a value on a particular property.
Nested Class Summary | |
---|---|
protected class |
DomainPropertyDescriptor.DomainProperty
Accesses the property of the specified instance using the details from the enclosing descriptor class. |
Field Summary | |
---|---|
protected org.codehaus.groovy.grails.commons.GrailsDomainClass |
domainClass
The domain class |
protected String[] |
names
The dot-separated name split into its component parts |
protected org.codehaus.groovy.grails.commons.GrailsDomainClassProperty |
property
The final, most-nested property |
Constructor Summary | |
DomainPropertyDescriptor(org.codehaus.groovy.grails.commons.GrailsDomainClassProperty property)
Initialise with simple property. |
|
DomainPropertyDescriptor(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, String propertyName)
Initialise with a domain class and an arbitrarily-nested property name. |
Method Summary | |
---|---|
Property
|
createProperty(DT instance)
Creates a new property for the specified instance |
Property
|
createProperty(DT instance, Map changedProperties)
Creates a new property for the specified instance, using the specified map to hold all changed properties for the instance. |
String
|
getName()
The dot-separated name |
Class
|
getPropertyType()
The type of the final property |
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
protected org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass
protected String[] names
protected org.codehaus.groovy.grails.commons.GrailsDomainClassProperty property
Constructor Detail |
---|
DomainPropertyDescriptor(org.codehaus.groovy.grails.commons.GrailsDomainClassProperty property)
I.e. no nesting, just use a domain class's direct property to initialise this class.
property
- The domain class's direct property to use.
DomainPropertyDescriptor(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, String propertyName)
Note this will throw an exception if the property name is invalid for the specified domain class.
domainClass
- The domain class to which the property name appliespropertyName
- The arbitrarily-nested property name of this domain class.
Method Detail |
---|
Property createProperty(DT instance)
Property createProperty(DT instance, Map changedProperties)
Whenever a field value is changed, all the properties are re-applied to the domain
instance using domainInstance.properties = changedProperties
.
This ensures that spring errors are not lost for other properties, whenever we set a value on a particular property.
String getName()
Class getPropertyType()
Groovy Documentation