Greg Brown <[email protected]> wrote:
After thinking this through a bit, I am starting to think that your
idea to use an annotation here might make sense. I believe you
suggested something along the lines of:
@IDProperty(name="foo")
Yes, or simply @Id, or @WtkxId to make clear that the wtkx:id gets injected.
@BxId also comes to mind, because you announced that WtkxSerializer
will be renamed to BeanSerializer.
Note that if you use "value" as annotation parameter, you can omit it
in the usage:
@IDProperty("foo")
You could also set the value "id" as default:
public interface @Id {
String value() = "id";
}
Thus, you only need to annotate a class with
@Id
public class Component {
...
}
and it is assumed to have a getId()/setId() pair.
Btw. my previous post about this is here (dated 05/07):
http://mail-archives.apache.org/mod_mbox/pivot-user/201005.mbox/%[email protected]%3e
If this attribute is specified, WTKXSerializer would propagate the
ID value to the given property. This would avoid the name
duplication and would be a fairly trivial change. I'm still not
convinced that it is absolutely necessary, but it is nice to have
and obviously has some use cases. Also, I believe Spring offers a
similar feature via the BeanNameAware interface, so it would be nice
to have a comparable feature.
Yes, it's like BeanNameAware, but annotations are less invasive
because they don't prescribe a certain method name.
Dirk.
G
On Jun 8, 2010, at 6:03 PM, Dirk Möbius wrote:
Greg Brown wrote:
We don't actually need an annotation for this. Simply adding the
getter and setter is sufficient to support the "name" attribute.
Oh, I thought the wtkx:id should be used as the name. So that you
don't have to set an id AND a name:
<PushButton wktx:id="myButton"/>
looks better than:
<PushButton wktx:id="myButton" name="myButton"/>
I thought it would have been considered as a general good thing to
have the wtkx:id injected into any object instance (of any type, in
case it's annotated).
Dirk.
--
Dirk Möbius
SCOOP GmbH
Am Kielshof 29
D-51105 Köln
Fon +49 221 801916-0
Fax +49 221 801916-17
Mobil +49 170 7363035
www.scoop-gmbh.de
Sitz der Gesellschaft: Köln
Handelsregister: Köln
Handelsregisternummer: HRB 36623
Geschäftsführer:
Dr. Oleg Balovnev
Frank Heinen
Dr. Wolfgang Reddig
Roland Scheel