samedi 4 avril 2015

Abstract factory pattern and serialization in Java

I have an interface A:



public interface A {
...
}


I have a factory interface FA:



public interface FA {
public A create();
public A deserialize(String pathToFile);
}


I want to have serialize(String pathToFile) interface method somewhere. And here comes the problem... Simple solution is to put it in A - but it's wrong, because serialization and deserialization logic should be in the same class. But how do I put it in FA? Making it generic seems to be a wrong path (FA<A>)


Aucun commentaire:

Enregistrer un commentaire