Re: Can this callback mechanism be generified?
Casper Bang wrote:
Mark Space wrote:
In fact that might be the first thing I do in a real program, make a
new object that is also it's own callback. No sense in proliferating
objects.
public class EmployeeInfo
implements Serializable,
Cloneable,
CallBack<EmployeeInfo>,
Compareable<EmployeeInfo>
{
Right, that use case should be covered. It's rarely practiced in my
experiences), because often you need to implement an interface more than
once, which of course you can't - in spite of having apparent different
signatures which dispatches to two distinct callback methods:
public class Formatter implements Callback<Date>, Callback<String>
...
Error: Repeated interface
/Casper
That's not what I meant. Unless I'm totally confused here, you look for
interface[0]. Which may or may not be the Callback interface. It could
be some other interface at index 0.
Now maybe you know this and were just doing as you say a quick mock up,
but I wanted to be clear.
Two parameterized interfaces of the same type aren't possible of course,
since erasure means that you've declared the same interface twice.
That's totally not what I show above, but again maybe you're already
ahead of me here.