Having some issues with genericity. So, here is a simple version of what I'm dealing with:
I have one abstract class and two subclasses:
public abstract class A {}
public class B extends A {}
public class C extends A {}
I'm writing writers for those classes, and I want to keep the same architecture, because all those have a lot in common. But I want to be able to call the writer without instantiating it
public abstract class AWriter<T extends A> {
public void AWritingMethod(T arg) {}
}
public class BWriter extends AWriter<B> {
public static void BWritingMethod(B arg) {
AWritingMethod(arg)
}
}
public class CWriter extends AWriter<C> {
public static void CWritingMethod(C arg) {
AWritingMethod(arg)
}
}
Obviously, I can't call AWritingMethod in BWriter and CWriter, but how could I do something like that to keep most of the work in AWriter, while still keeping BWritingMethod and CWritingMethod static ?
Thanks already !
LD