I've need an interface that assures me a certain method, including specific signature, is available. So far his is what I have:
public interface Mappable<M> {
M mapTo(M mappableEntity);
}
The problem arises when a class should be mappable to multiple other entities. The ideal case would be this (not java):
public class Something implements Mappable<A>, Mappable<B> {
public A mapTo(A someObject) {...}
public B mapTo(B someOtherObject) {...}
}
What would be the best way to achieve this remaining as "generic" as possible?