Example usage for com.google.gson JsonArray addAll

List of usage examples for com.google.gson JsonArray addAll

Introduction

In this page you can find the example usage for com.google.gson JsonArray addAll.

Prototype

public void addAll(JsonArray array) 

Source Link

Document

Adds all the elements of the specified array to self.

Usage

From source file:org.qcert.runtime.BinaryOperators.java

License:Apache License

public static JsonElement union(JsonElement e1, JsonElement e2) {
    final JsonArray dst = new JsonArray();
    dst.addAll(e1.getAsJsonArray());
    dst.addAll(e2.getAsJsonArray());/*from w  w  w  .  j  a  v a  2s  .  co  m*/
    return dst;
}

From source file:org.qcert.runtime.BinaryOperators.java

License:Apache License

/**
 * (Shallow) copies an array.  Note that shallow copying suffices since 
 * everything is assumed immutable.//from   w  w w.jav  a2 s  . c  o m
 * @param src
 * @return
 */
public static JsonArray copyArray(JsonArray src) {
    final JsonArray dst = new JsonArray();
    dst.addAll(src);
    return dst;
}

From source file:org.qcert.runtime.UnaryOperators.java

License:Apache License

public static JsonElement flatten(JsonElement e) {
    final JsonArray dst = new JsonArray();
    final JsonArray src = e.getAsJsonArray();
    for (final JsonElement elem : src) {
        dst.addAll(elem.getAsJsonArray());
    }/*from   www.j av a 2 s  .c o  m*/
    return dst;
}

From source file:pt.ist.fenixedu.giaf.invoices.ui.InvoiceController.java

License:Open Source License

@RequestMapping(method = RequestMethod.GET)
public String home(@RequestParam(required = false) String username, final Model model) {
    final User user = getUser(username);

    if (isAllowedToAccess(user)) {
        final Person person = user.getPerson();

        final JsonArray events = new JsonArray();
        person.getEventsSet().stream().sorted(Event.COMPARATOR_BY_DATE).map(this::toJsonArray)
                .forEach(a -> events.addAll(a));
        model.addAttribute("events", events);
    }/*from  w w  w .j  a v a2  s.c  om*/

    return "giaf-invoice-viewer/home";
}

From source file:xyz.putzi.slackmc.common.messaging.builder.DefaultSlackAttachmentBuilder.java

License:Open Source License

@Override
public JsonArray getJsonArray() {
    Objects.requireNonNull(jsonArray, "JsonArray");

    JsonArray arrayToReturn = new JsonArray();
    arrayToReturn.addAll(jsonArray);
    jsonArray = new JsonArray();
    return arrayToReturn;
}

From source file:xyz.putzi.slackmc.common.messaging.builder.DefaultSlackFieldBuilder.java

License:Open Source License

@Override
public JsonArray getJsonArray(Boolean clearForNextField) {
    Objects.requireNonNull(jsonArray, "JsonArray");

    if (clearForNextField) {
        JsonArray arrayToReturn = new JsonArray();
        arrayToReturn.addAll(jsonArray);
        jsonArray = new JsonArray();
        return arrayToReturn;
    } else {// w  ww . j a  v a2  s .c  o  m
        return this.jsonArray;
    }
}