Java Json Create createArrayBuilder()

Here you can find the source of createArrayBuilder()

Description

Creates a JSON array builder

License

Apache License

Return

a JSON array builder

Declaration

public static JsonArrayBuilder createArrayBuilder() 

Method Source Code

//package com.java2s;
/*/*from w  w w .j a v  a  2s.  c  o  m*/
 * Copyright (c) 2018 PonySDK
 *  Owners:
 *  Luciano Broussal  <luciano.broussal AT gmail.com>
 *  Mathieu Barbier   <mathieu.barbier AT gmail.com>
 *  Nicolas Ciaravola <nicolas.ciaravola.pro AT gmail.com>
 *
 *  WebSite:
 *  http://code.google.com/p/pony-sdk/
 *
 * Licensed 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.
 */

import javax.json.JsonArrayBuilder;

import javax.json.spi.JsonProvider;

public class Main {
    /**
     * A constant representing the name of the default {@code JsonProvider} implementation class.
     */
    private static final String DEFAULT_PROVIDER = "org.glassfish.json.JsonProviderImpl";

    /**
     * Creates a JSON array builder
     *
     * @return a JSON array builder
     */
    public static JsonArrayBuilder createArrayBuilder() {
        return createJsonProvider().createArrayBuilder();
    }

    public static final JsonProvider createJsonProvider() {
        try {
            return (JsonProvider) Class.forName(DEFAULT_PROVIDER).getDeclaredConstructor().newInstance();
        } catch (final Exception e) {
            return JsonProvider.provider();
        }
    }
}

Related

  1. buildContentResponse(String userId, String message)
  2. buildJsonArray(String[][] twoDimensionArray)
  3. convertToJson(Object myObject)
  4. convertToJson(Object obj)
  5. createArrayBuilder()
  6. createJsonFrom(JsonObject user, String... ignoreKeys)
  7. createJsonValue(String string)
  8. createPrettyWriterFactory()
  9. emptyArray()