package com.alibaba.json.test.codec;

import java.util.Collection;

import net.minidev.json.JSONValue;

public class JsonSmartCodec implements Codec {

    public String getName() {
        return "json-smart";
    }

    public <T> T decodeObject(String text, Class<T> clazz) throws Exception {
        throw new UnsupportedOperationException();
    }

    public <T> Collection<T> decodeArray(String text, Class<T> clazz) throws Exception {
        throw new UnsupportedOperationException();
    }

    public Object decodeObject(String text) throws Exception {
        Object value =  JSONValue.parse(text);
        
        return value;
    }

    public Object decode(String text) throws Exception {
        Object value = JSONValue.parse(text);
        
        return value;
    }

    public String encode(Object object) throws Exception {
        return JSONValue.toJSONString(object);
    }


    public <T> T decodeObject(byte[] input, Class<T> clazz) throws Exception {
        throw new UnsupportedOperationException();
    }
}
