Java Json addAll(JsonObjectBuilder a, JsonObjectBuilder b)

Here you can find the source of addAll(JsonObjectBuilder a, JsonObjectBuilder b)

Description

add All

License

Apache License

Declaration

public static JsonObjectBuilder addAll(JsonObjectBuilder a, JsonObjectBuilder b) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Objects;

import javax.json.JsonArray;
import javax.json.JsonArrayBuilder;

import javax.json.JsonObject;
import javax.json.JsonObjectBuilder;

public class Main {
    public static JsonObjectBuilder addAll(JsonObjectBuilder a, JsonObjectBuilder b) {
        Objects.requireNonNull(a);
        Objects.requireNonNull(b);
        return addAll(a, b.build());
    }//  w  w  w . ja v a2 s .  com

    public static JsonObjectBuilder addAll(JsonObjectBuilder a, JsonObject b) {
        Objects.requireNonNull(a);
        Objects.requireNonNull(b);
        b.forEach(a::add);
        return a;
    }

    public static JsonArrayBuilder addAll(JsonArrayBuilder a, JsonArrayBuilder b) {
        Objects.requireNonNull(a);
        Objects.requireNonNull(b);
        return addAll(a, b.build());
    }

    public static JsonArrayBuilder addAll(JsonArrayBuilder a, JsonArray b) {
        Objects.requireNonNull(a);
        Objects.requireNonNull(b);
        b.forEach(a::add);
        return a;
    }
}

Related

  1. asJsonObject(JsonValue value)
  2. asString(JsonValue value)
  3. compare(JsonValue expected, JsonValue actual, boolean strict)
  4. convertJsonValue(Object jsonValue, Class desiredType)