Staticaly binding by method name
- From: dontspam@xxxxxxxxxx
- Date: 27 Jul 2005 23:46:29 -0700
I am writing an infrastructure that includes dynamic binding of
controls to object attributes using reflection, i.e.
<snippet>
// This will set up a column binded to the "getFirstName()" method
ColumnControl col=new ColumnControl("Name");
col.bindText("getFirstName");
// Now an object added to a grid with this column must support
// "getFirstName()"!
</snippet>
One of my users requested binding at compile time, so that she will get
compile errors if the getter method is mistyped.
Soumething of the sort:
<impossible-snippet>
ColumnControl col=new ColumnControl("Name");
col.bindText(User.class,User.class.getFirstName);
</impossible-snippet>
This is an excellent idea but I can't figure out how to bind to a
method reference in compile time. (In C++ this would have been easy
enough - but then again other things would be hard...)
Any ideas?
.
- Prev by Date: Re: J2EE installation help
- Next by Date: Re: change log comments
- Previous by thread: how to fill the string to length = 256
- Next by thread: How to covert String("6,400.0") to Double ?
- Index(es):
Relevant Pages
|