io.rebind.vertx.orientdb.model.ConnectionConverter.java Source code

Java tutorial

Introduction

Here is the source code for io.rebind.vertx.orientdb.model.ConnectionConverter.java

Source

/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.rebind.vertx.orientdb.model;

import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;

/**
 * Converter for {@link io.rebind.vertx.orientdb.model.Connection}.
 *
 * NOTE: This class has been automatically generated from the {@link io.rebind.vertx.orientdb.model.Connection} original class using Vert.x codegen.
 */
public class ConnectionConverter {

    public static void fromJson(JsonObject json, Connection obj) {
        if (json.getValue("label") instanceof String) {
            obj.setLabel((String) json.getValue("label"));
        }
        if (json.getValue("record") instanceof JsonObject) {
            obj.setRecord(new io.rebind.vertx.orientdb.model.Record((JsonObject) json.getValue("record")));
        }
    }

    public static void toJson(Connection obj, JsonObject json) {
        if (obj.getLabel() != null) {
            json.put("label", obj.getLabel());
        }
        if (obj.getRecord() != null) {
            json.put("record", obj.getRecord().toJson());
        }
    }
}