Java tutorial
/* * 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.hijynx.ensemble.identity; import io.vertx.core.json.JsonObject; import io.vertx.core.json.JsonArray; /** * Converter for {@link io.hijynx.ensemble.identity.Privilege}. * * NOTE: This class has been automatically generated from the {@link io.hijynx.ensemble.identity.Privilege} original class using Vert.x codegen. */ public class PrivilegeConverter { public static void fromJson(JsonObject json, Privilege obj) { if (json.getValue("description") instanceof String) { obj.setDescription((String) json.getValue("description")); } if (json.getValue("privilegeCreate") instanceof Boolean) { obj.setPrivilegeCreate((Boolean) json.getValue("privilegeCreate")); } if (json.getValue("privilegeDelete") instanceof Boolean) { obj.setPrivilegeDelete((Boolean) json.getValue("privilegeDelete")); } if (json.getValue("privilegeId") instanceof String) { obj.setPrivilegeId((String) json.getValue("privilegeId")); } if (json.getValue("privilegeName") instanceof String) { obj.setPrivilegeName((String) json.getValue("privilegeName")); } if (json.getValue("privilegeRead") instanceof Boolean) { obj.setPrivilegeRead((Boolean) json.getValue("privilegeRead")); } if (json.getValue("privilegeUpdate") instanceof Boolean) { obj.setPrivilegeUpdate((Boolean) json.getValue("privilegeUpdate")); } if (json.getValue("target") instanceof String) { obj.setTarget((String) json.getValue("target")); } } public static void toJson(Privilege obj, JsonObject json) { if (obj.getDescription() != null) { json.put("description", obj.getDescription()); } if (obj.getPrivilegeCreate() != null) { json.put("privilegeCreate", obj.getPrivilegeCreate()); } if (obj.getPrivilegeDelete() != null) { json.put("privilegeDelete", obj.getPrivilegeDelete()); } if (obj.getPrivilegeId() != null) { json.put("privilegeId", obj.getPrivilegeId()); } if (obj.getPrivilegeName() != null) { json.put("privilegeName", obj.getPrivilegeName()); } if (obj.getPrivilegeRead() != null) { json.put("privilegeRead", obj.getPrivilegeRead()); } if (obj.getPrivilegeUpdate() != null) { json.put("privilegeUpdate", obj.getPrivilegeUpdate()); } if (obj.getTarget() != null) { json.put("target", obj.getTarget()); } } }