/**
 * Copyright (c) 2016,2017 Bosch Software Innovations GmbH.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Bosch Software Innovations GmbH - initial creation
 */

package org.eclipse.hono.util;

import io.vertx.core.json.JsonObject;

/**
 * A container for the result returned by Hono's registration API.
 *
 */
public final class RegistrationResult extends RequestResponseResult<JsonObject> {
    private RegistrationResult(final int status, final JsonObject payload) {
        super(status, payload);
    }

    public static RegistrationResult from(final int status) {
        return new RegistrationResult(status, null);
    }

    public static RegistrationResult from(final int status, final JsonObject payload) {
        return new RegistrationResult(status, payload);
    }

    public static RegistrationResult from(final int status, final String payloadString) {
        if (payloadString != null) {
            return new RegistrationResult(status, new JsonObject(payloadString));
        } else {
            return new RegistrationResult(status, null);
        }
    }
}

@@ -23,12 +23,13 @@
 016,
+ 
 201
-7
+8
  Bos
@@ -421,16 +421,59 @@
 .util;%0A%0A
+import io.vertx.core.json.DecodeException;%0A
 import i
@@ -663,16 +663,17 @@
 ject%3E %7B%0A
+%0A
     priv
@@ -788,276 +788,981 @@
     
-public static RegistrationResult from(final int status) %7B%0A        return new RegistrationResult(status, null);%0A    %7D%0A%0A    public static RegistrationResult from(final int status, final JsonObject payload) %7B%0A        return new RegistrationResult(status, payload);%0A    %7D%0A
+/**%0A     * Creates a new result for a status code.%0A     * %0A     * @param status The status code.%0A     * @return The result.%0A     */%0A    public static RegistrationResult from(final int status) %7B%0A        return new RegistrationResult(status, null);%0A    %7D%0A%0A    /**%0A     * Creates a new result for a status code and a payload.%0A     * %0A     * @param status The status code.%0A     * @param payload The payload to include in the result.%0A     * @return The result.%0A     */%0A    public static RegistrationResult from(final int status, final JsonObject payload) %7B%0A        return new RegistrationResult(status, payload);%0A    %7D%0A%0A    /**%0A     * Creates a new result for a status code and a payload.%0A     * %0A     * @param status The status code.%0A     * @param payload The string representation of the JSON payload%0A     *                to include in the result (may be %7B@code null%7D).%0A     * @return The result.%0A     * @throws DecodeException if the given payload is not valid JSON.%0A     */
 %0A   
@@ -1838,22 +1838,16 @@
  payload
-String
 ) %7B%0A    
@@ -1861,22 +1861,16 @@
 (payload
-String
  != null
@@ -1945,22 +1945,16 @@
 (payload
-String
 ));%0A    

Add JavaDoc.