Use netconf-3.0.5
[ovsdb.git] / library / impl / src / main / java / org / opendaylight / ovsdb / lib / jsonrpc / JsonUtils.java
1 /*
2  * Copyright (c) 2014, 2015 EBay Software Foundation 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.ovsdb.lib.jsonrpc;
9
10 import com.fasterxml.jackson.core.JsonProcessingException;
11 import com.fasterxml.jackson.databind.ObjectMapper;
12 import com.fasterxml.jackson.databind.ObjectWriter;
13
14 public final class JsonUtils {
15     private static final ObjectWriter PRETTY_WRITER = new ObjectMapper().writerWithDefaultPrettyPrinter();
16
17     private JsonUtils() {
18     }
19
20     public static String prettyString(final Object jsonNode) {
21         try {
22             return PRETTY_WRITER.writeValueAsString(jsonNode);
23         } catch (JsonProcessingException e) {
24             throw new RuntimeException(e);
25         }
26     }
27 }