Added more ignorable files to .gitignore
[ovsdb.git] / ovsdb / src / main / java / org / opendaylight / ovsdb / lib / notation / json / OVSDBTypesIDResolver.java
1 /*
2  * Copyright (C) 2013 Red Hat, Inc.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Authors : Madhu Venugopal, Ashwin Raveendran
9  */
10 package org.opendaylight.ovsdb.lib.notation.json;
11
12 import com.fasterxml.jackson.annotation.JsonTypeInfo;
13 import com.fasterxml.jackson.databind.JavaType;
14 import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
15 import com.fasterxml.jackson.databind.type.TypeFactory;
16
17 import org.opendaylight.ovsdb.lib.notation.OvsDBSet;
18 import org.opendaylight.ovsdb.lib.notation.UUID;
19
20 public  class OVSDBTypesIDResolver implements TypeIdResolver {
21
22         private JavaType baseType;
23
24         @Override
25         public void init(JavaType bt) {
26             this.baseType = bt;
27         }
28
29         @Override
30         public String idFromValue(Object value) {
31             throw new UnsupportedOperationException("not yet done");
32         }
33
34         @Override
35         public String idFromValueAndType(Object value, Class<?> suggestedType) {
36             throw new UnsupportedOperationException("not yet done");
37         }
38
39         @Override
40         public String idFromBaseType() {
41             throw new UnsupportedOperationException("not yet done");
42         }
43
44         @Override
45         public JavaType typeFromId(String id) {
46             if ("set".equals(id)) {
47                 return TypeFactory.defaultInstance().constructCollectionType(OvsDBSet.class, Object.class);
48             } else if ("uuid".equals(id) || "named-uuid".equals(id)) {
49                 return TypeFactory.defaultInstance().constructType(UUID.class);
50             }
51             return null;
52         }
53
54         @Override
55         public JsonTypeInfo.Id getMechanism() {
56             throw new UnsupportedOperationException("not yet done");
57         }
58     }