In Java, I\'d like to be able to define marker interfaces, that forced implementations to provide static methods. For example, for simple text-serialization/deserialization
Just an idea to consider: You can separate the transformation logic from the objects themselves, and then you have a fixed set of transformers, implementing the following interface :
public interface Transformer{
public T fromText(String text);
public String toText(T obj);
}
Your actual data classes can have a method getTransformer() that returns the right transformer for them.