title: How to restrict types which are allowed as "T" in a generic class?
body: <p>I've got a class <code>Foo&lt;T&gt;</code>. How can I say that I want <code>T</code> to be some class implementing <code>BarInterface</code>? Writing simply <code>class Foo&lt;T implements BarInterface&gt;</code> doesn't compile.</p>