Fix ALOTOF Checkstyle violation, and switch over to enforcement.
[ovsdb.git] / library / impl / src / main / java / org / opendaylight / ovsdb / lib / notation / json / OvsdbTypesIdResolver.java
1 /*
2  * Copyright (c) 2013, 2015 Red Hat, Inc. and others. All rights reserved.
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
9 package org.opendaylight.ovsdb.lib.notation.json;
10
11 import com.fasterxml.jackson.annotation.JsonTypeInfo;
12 import com.fasterxml.jackson.databind.JavaType;
13 import com.fasterxml.jackson.databind.jsontype.impl.TypeIdResolverBase;
14 import com.fasterxml.jackson.databind.type.TypeFactory;
15 import org.opendaylight.ovsdb.lib.notation.OvsdbSet;
16 import org.opendaylight.ovsdb.lib.notation.UUID;
17
18 public  class OvsdbTypesIdResolver extends TypeIdResolverBase {
19
20     private JavaType baseType;
21
22     @Override
23     public void init(JavaType bt) {
24         this.baseType = bt;
25     }
26
27     @Override
28     public String idFromValue(Object value) {
29         throw new UnsupportedOperationException("not yet done");
30     }
31
32     @Override
33     public String idFromValueAndType(Object value, Class<?> suggestedType) {
34         throw new UnsupportedOperationException("not yet done");
35     }
36
37     @Override
38     public String idFromBaseType() {
39         throw new UnsupportedOperationException("not yet done");
40     }
41
42     @Override
43     public JavaType typeFromId(String id) {
44         if ("set".equals(id)) {
45             return TypeFactory.defaultInstance().constructCollectionType(OvsdbSet.class, Object.class);
46         } else if ("uuid".equals(id) || "named-uuid".equals(id)) {
47             return TypeFactory.defaultInstance().constructType(UUID.class);
48         }
49         return null;
50     }
51
52     @Override
53     public JsonTypeInfo.Id getMechanism() {
54         throw new UnsupportedOperationException("not yet done");
55     }
56 }