GNPy client refactor
[transportpce.git] / pce / src / main / java / org / opendaylight / transportpce / pce / gnpy / consumer / GnpyApiModule.java
1 /*
2  * Copyright © 2021 Orange, 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 package org.opendaylight.transportpce.pce.gnpy.consumer;
9
10 import com.fasterxml.jackson.databind.module.SimpleModule;
11 import com.fasterxml.jackson.datatype.jsr310.PackageVersion;
12 import org.opendaylight.transportpce.common.converter.JsonStringConverter;
13 import org.opendaylight.yang.gen.v1.gnpy.gnpy.api.rev190103.GnpyApi;
14 import org.opendaylight.yang.gen.v1.gnpy.path.rev200909.Result;
15
16 //This class is a temporary workaround while waiting jackson
17 //support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852
18 public class GnpyApiModule extends SimpleModule {
19
20     private static final long serialVersionUID = 1L;
21
22     public GnpyApiModule(JsonStringConverter<GnpyApi> gnpyApiConverter, JsonStringConverter<Result> resultConverter) {
23         super(PackageVersion.VERSION);
24         addSerializer(GnpyApi.class, new GnpyApiSerializer(gnpyApiConverter));
25         addDeserializer(Result.class, new ResultDeserializer(resultConverter));
26     }
27
28 }