Use two interfaces: A and AFactory
A is the interface.
AFactory implements all the factory methods as well as behavior relevant to the Class rather than any particular object.
Then you have
public class MyA implements A {
// ...
public class MyAFactory implements AFactory<MyA> {
// ...
}
}
If something else is parameterized by the interface C, we can do:
public class Container<T extends A> {
private final AFactory<T> factory;
private Container(AFactory<T> factory) {
this.factory = factory;
}
// ...
}
Now wherever you’d like to write
T.foo(t1, t2)
you can write
factory.foo(t1, t2)