I have two classes for records: saving to the database and saving to a file. Both classes implement the RecordsSaver
interface:
public interface RecordsSaver { public void saveRecond(); }
The problem is that each of the classes should be required to implement the static generation method getRecordsSaver
. However, if the interface implements such a static method, it can no longer be overridden in a class, similarly to abstract classes.
Tell me how to either override the method, or is there any other way out of this situation?
FileRecordSaver.getRecordSaver( record ).saveRecord()
? - zRrr