What I am trying to do is implement a fixed set of converters as abstract enums with individual implementations, and supply different generics per implementation. The below code doesn't work, but it should indicate what I am trying to do. I am all but certain the answer is 'no'. If I remove all generics and use type casting, this will for sure work. But I'd prefer generics
public enum Converter implements ValueConverter<I,O> {
LONG_DOUBLE<Long,Double> {
@Override
public Long convertInput(Double value) {
return null;
}
@Override
public Double convertOutput(Long value) {
return null;
}
},
DATE_LOCALDATE<Date,LocalDate> {
@Override
public Date convertInput(LocalDate value) {
return null;
}
@Override
public LocalDate convertOutput(Date value) {
return null;
}
}
}