Unfortunately in Java, you can't invoke a specific subclass version of
an overridden method.

That means that either
(a) you have to trust that each method correctly invokes super.__bind
(b) we need a more complex scheme.

Something like having each class X define a method
 public void __bind(X myself, WTKXSerializer serializer)
And then WTKXSerializer#bind() could walk up the class hierarchy,
and use reflection to find the __bind methods and invoke them.

But maybe someone can come up with a scheme that involves less magic?
(I like reflection, but it's best used in small doses).


On Tue, Jun 9, 2009 at 17:14, Greg Brown<[email protected]> wrote:
> I think this will actually work, and won't require too many changes. The
> bind processor can add the Bindable interface to every class that uses an
> @Bind annotation. The interface would contain a single method:
>
> public void __bind(WTKXSerializer serializer);
>
> WTKXSerializer#bind() would check to see if the bound object implemented
> Bindable; if so, it would walk up the object's class hierarchy looking for
> subclasses that implement Bindable. When found, it would invoke the specific
> __bind() method defined by the subclass.
>
> Sound right?
>

Reply via email to