All Downloads are FREE. Search and download functionalities are using the official Maven repository.

me.redtea.carcadex.data.schema.file.impl.serialize.SerializeSchemaStrategy Maven / Gradle / Ivy

There is a newer version: 2.0.1-BETA
Show newest version
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() {

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy