package com.discobeard.lwjgl.commons;

import com.discobeard.lwjgl.file.FileUtils;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.IOException;
import java.io.InputStream;

public class JSONMapper<T> {

    public T FileToObject(String location, Class clazz) {

        InputStream stream = FileUtils.getFileInputStream(location);
        ObjectMapper mapper = new ObjectMapper();

        T obj = null;
        try {
            obj = (T) mapper.readValue(stream, clazz);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return obj;
    }

}


