Staticaly binding by method name



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?

.



Relevant Pages

  • Re: VFS: C99 sparse format for struct vfsops
    ... It allows for dynamic binding of methods that implement a ... kobj basically provides us with some OO type functionality. ... can't be determined at compile time since you don't know what methods an ...
    (freebsd-current)
  • Re: Binding
    ... > what is static and dynamic binding? ... In the context of functions in a programming language, ... done at compile time ... Look up 'pointer to function'. ...
    (comp.lang.c)
  • Re: Does "dynamic binding" mean the same thing as "polymorphism"
    ... but that dynamic binding allows for more than just polymorphism. ... you want to treat objects without knowing their type at compile time. ... Polymorphism is the actual runtime use of *multiple* forms. ...
    (alt.comp.lang.learn.c-cpp)