Can I somehow partially implement a bunch of generics of a single class? What I would like to achieve is that I can accept a generic only when somone really relies on that type. See the following foo/bar example for a demonstration purpose of what I am looking for:
import java.util.Date;
public class Sample {
public static abstract class ASomeFunc<AK, AV, PK, PV> {
public void forwardTo(ASomeFunc<?, ?, PK, PV> lala) {
}
// EDIT 1:
// we do some logic here and then pass a map entry to an actual implementation
// but somethimes I do not care what the key is I am just interested in what the value is
// public abstract Map.Entry<PK, PV> compute(Map.Entry<AK, AV> data);
}
public static class SomeFunc2 extends ASomeFunc<Date, String, Number, Number> {
}
// what I would like to do:
// public static class SomeOtherFunc extends ASomeFunc<?, Number, ?, Number> {
// but I ony can:
public static class SomeOtherFunc extends ASomeFunc<Object, Number, Object, Number> {
}
public static void main(String[] args) {
// but this now clashes ... sinc object is explicitly defined
new SomeFunc2().forwardTo(new SomeOtherFunc());
}
}