Re: Semantics of ^ in value bindings in .wod file.
Re: Semantics of ^ in value bindings in .wod file.
- Subject: Re: Semantics of ^ in value bindings in .wod file.
- From: Archibal Singleton <email@hidden>
- Date: Mon, 31 Dec 2007 16:03:55 -0300
Thank you very much indeed for your explanation Anjo. Much appreciated.
You're right indeed that the valueForBinding() already gets the
binding from the parent so parent().valueForBinding() would get the
binding from "grand-parent" of the component.
Cheers,
= tmk =
On 29 Dec 2007, at 16:14, Anjo Krank wrote:
Am 29.12.2007 um 18:57 schrieb Archibal Singleton:
^foo in the wod is the same as parent().valueForBinding("foo") in
java
parent.foo in the wod is the same as parent.valueForKey("foo") in
java
The first line requires a parent with foo bound. The second line
requires a variable or method named foo.
Thanks for the clarification Uli, the nuance is indeed important
and I didn't get it at first.
It's important and unfortunately is not quite right. Assume your
parent java has:
public String hello() {return "Hello"}
The parent wod has
MySub : MySub {
foo = hello;
}
The child MySub has:
MyFoo : WOString {
value = ^foo;
}
Then you get whatever your parent has bound against the child
instance's "foo" binding. This is NOT the same as
parent().valueForBinding("foo"), which would get what the parent of
the parent of MySub had bound to "foo".
It mainly a shortcut so you don't have to write in the child java:
public Object foo() {return valueForBinding("foo")}
and in the child wod:
MyFoo : WOString {
value = foo;
}
I'm normally not picky about stuff, but this IS an important concept
and in particular valueForKey() and valueForBinding() can be hard to
tell apart...
Cheers, Anjo
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden