Generic classes with parameterized super class and interface

Hello.

I'm trying to write a generic class that looks like the following pseudo-code.

publicinterface Interface{

public Interface getSibling(...);

}

publicclass Klass{...}

publicclass MyKlass<Textends Klass, T2extends Interface>

extends Timplements T2{

public T2 getSibling(...){

returnthis;

}

}

where Interface and Klass each have various extensions.

I came across this problem, or challenge, while writing classes for testing my EJBs. I tried and failed various attempts.

Is it possible to write generic classes of this nature in Java?

If so, please tell me and others who are like me.

Thanks in advance.

[1394 byte] By [mjkhan21a] at [2007-11-27 11:29:40]
# 1

No. That would not work.

Beside being forbidden by the compiler, to my understanding, it cannot be done in theory either, as the parameterized types get bound at instantiation time and are not available for static reference, which both extends and implements require.

stefan.schulza at 2007-7-29 16:29:20 > top of Java-index,Core,Core APIs...