/*
 * Copyright (C) 2013 Red Hat, Inc.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 *
 * Authors : Madhu Venugopal, Ashwin Raveendran
 */
package org.opendaylight.ovsdb.lib.notation.json;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.type.TypeFactory;

import org.opendaylight.ovsdb.lib.notation.OvsdbSet;
import org.opendaylight.ovsdb.lib.notation.UUID;

public  class OvsdbTypesIdResolver implements TypeIdResolver {

    private JavaType baseType;

    @Override
    public void init(JavaType bt) {
        this.baseType = bt;
    }

    @Override
    public String idFromValue(Object value) {
        throw new UnsupportedOperationException("not yet done");
    }

    @Override
    public String idFromValueAndType(Object value, Class<?> suggestedType) {
        throw new UnsupportedOperationException("not yet done");
    }

    @Override
    public String idFromBaseType() {
        throw new UnsupportedOperationException("not yet done");
    }

    @Override
    public JavaType typeFromId(String id) {
        if ("set".equals(id)) {
            return TypeFactory.defaultInstance().constructCollectionType(OvsdbSet.class, Object.class);
        } else if ("uuid".equals(id) || "named-uuid".equals(id)) {
            return TypeFactory.defaultInstance().constructType(UUID.class);
        }
        return null;
    }

    @Override
    public JsonTypeInfo.Id getMechanism() {
        throw new UnsupportedOperationException("not yet done");
    }
}
@@ -417,16 +417,71 @@
 peInfo;%0A
+import com.fasterxml.jackson.databind.DatabindContext;%0A
 import c
@@ -1709,32 +1709,429 @@
 rn null;%0A    %7D%0A%0A
+    @Override%0A    public JavaType typeFromId(DatabindContext databindContext, String id) %7B%0A        if (%22set%22.equals(id)) %7B%0A            return databindContext.getTypeFactory().constructCollectionType(OvsdbSet.class, Object.class);%0A        %7D else if (%22uuid%22.equals(id) %7C%7C %22named-uuid%22.equals(id)) %7B%0A            return databindContext.constructType(UUID.class);%0A        %7D%0A        return null;%0A    %7D%0A%0A
     @Override%0A  

Support Jackson 2.5