001package net.sf.jkniv.whinstone.couchdb.commands;
002
003import java.io.IOException;
004
005import com.fasterxml.jackson.core.JsonParser;
006import com.fasterxml.jackson.core.JsonProcessingException;
007import com.fasterxml.jackson.core.ObjectCodec;
008import com.fasterxml.jackson.databind.DeserializationContext;
009import com.fasterxml.jackson.databind.JsonDeserializer;
010import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
011
012import net.sf.jkniv.whinstone.couchdb.CouchDbResult;
013
014import com.fasterxml.jackson.databind.JsonNode;
015
016public class JsonFindDeserialization extends StdDeserializer<CouchDbResult>
017{
018    public JsonFindDeserialization() {
019        this(null);
020    }
021 
022    public JsonFindDeserialization(Class<?> vc) {
023        super(vc);
024    }
025    
026    @Override
027    public CouchDbResult deserialize(JsonParser json, DeserializationContext ctxt)
028            throws IOException, JsonProcessingException
029    {
030        ObjectCodec codec = json.getCodec();
031        JsonNode node = codec.readTree(json);
032        final String bookmark = node.get("bookmark").asText();
033        final String warning = node.get("warning").asText();
034        final String contents = node.get("docs").asText();
035        
036        return null;
037        //return new Program(id, name, contents, user);
038    }
039    
040}