Groovy Documentation

org.grails.plugin.vaadin.data
[Groovy] Class DomainPropertyDescriptor

java.lang.Object
  org.grails.plugin.vaadin.data.DomainPropertyDescriptor
All Implemented Interfaces:
VaadinPropertyDescriptor

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.

Authors:
Francis McKenzie


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

domainClass

protected org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass
The domain class


names

protected String[] names
The dot-separated name split into its component parts


property

protected org.codehaus.groovy.grails.commons.GrailsDomainClassProperty property
The final, most-nested property


 
Constructor Detail

DomainPropertyDescriptor

DomainPropertyDescriptor(org.codehaus.groovy.grails.commons.GrailsDomainClassProperty property)
Initialise with simple property.

I.e. no nesting, just use a domain class's direct property to initialise this class.

Parameters:
property - The domain class's direct property to use.


DomainPropertyDescriptor

DomainPropertyDescriptor(org.codehaus.groovy.grails.commons.GrailsDomainClass domainClass, String propertyName)
Initialise with a domain class and an arbitrarily-nested property name.

Note this will throw an exception if the property name is invalid for the specified domain class.

Parameters:
domainClass - The domain class to which the property name applies
propertyName - The arbitrarily-nested property name of this domain class.


 
Method Detail

createProperty

Property createProperty(DT instance)
Creates a new property for the specified instance


createProperty

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.

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.


getName

String getName()
The dot-separated name


getPropertyType

Class getPropertyType()
The type of the final property


 

Groovy Documentation