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

com.syntaxphoenix.syntaxapi.data.DataFactory Maven / Gradle / Ivy

The newest version!
package com.syntaxphoenix.syntaxapi.data;

import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;

public abstract class DataFactory {

    private final DataAdapterRegistry adapterRegistry;

    public DataFactory(DataAdapterRegistry adapterRegistry) {
        this.adapterRegistry = adapterRegistry;
    }

    /*
     * Get
     */

    public DataAdapterRegistry getAdapaterRegistry() {
        return adapterRegistry;
    }

    /*
     * Serialize
     */

    public abstract DataFactory toFile(DataContainer holder, File file);

    public abstract DataFactory toStream(DataContainer holder, OutputStream stream);

    public abstract DataFactory toString(DataContainer holder, StringBuilder builder);

    /*
     * Deserialize
     */

    public abstract DataFactory fromFile(DataContainer holder, File file);

    public abstract DataFactory fromStream(DataContainer holder, InputStream stream);

    public abstract DataFactory fromString(DataContainer holder, String string);

}