me.redtea.carcadex.data.schema.file.impl.serialize.SerializeSchemaStrategy Maven / Gradle / Ivy
package me.redtea.carcadex.data.schema.file.impl.serialize;
import me.redtea.carcadex.data.serializer.CommonSerializer;
import me.redtea.carcadex.data.schema.file.AbstractFileSchemaStrategy;
import java.io.*;
public class SerializeSchemaStrategy extends AbstractFileSchemaStrategy {
private final CommonSerializer serializer;
public SerializeSchemaStrategy(File folder, CommonSerializer serializer, String filenameExtension) {
super(folder, filenameExtension);
this.serializer = serializer;
}
public SerializeSchemaStrategy(File folder, CommonSerializer serializer) {
super(folder);
this.serializer = serializer;
}
@Override
protected V fromFile(String string) {
return serializer.deserialize(string);
}
@Override
protected String toFile(V value) {
return serializer.serialize(value);
}
@Override
public void close() {
}
}