Have Your People Call My People: Binding
By Andres Almiray, Danno Ferrin, and Geertjan Wielenga2009-12-28
It's nice that we can create changes in Groovy objects that can be observed by an interested party, but that is only half the story. Really, we want to do some cool stuff with these changes, and what would be really magical is if we could do some of these things automatically. In this segment, you'll do just that when you learn how to bind one value to some other value.
What is a binding? In Griffon a binding has three constituent parts: a trigger, a read, and a write. The trigger tells the binding that it needs to update, the read tells the binding what the new value is, and the write takes the new value and does something with it.
![]() |
This article is based on Griffon In Action, published November, 2009. It is being reproduced here by permission from Manning Publications. Manning early access books and ebooks are sold exclusively through Manning. Visit the book's page for more information. Developer Tutorial readers can get 30% off any version (ebook or print book) of Griffon In Action. Simply use the code "devtut30" at checkout. |
JavaBeans bound properties provide the simplest manifestation of a binding (table 1).
Table 1: A binding from a JavaBean's point of view
| Binding Part | Description |
| Trigger | The property getting changed |
| Read | The source is reading the value of the property |
| Write | The target is storing the new property value in the variable |
However, we can make any of the three pieces of a binding as complex as we need to make them. In fact, as you write a Griffon application you are probably using some rather complex binding mojo without even knowing it. That's the point.
Tutorial pages:
|
|
|||||||||
You might also want to check these out:
|
Link to This Tutorial Page!


