/** * Creates a JSON object builder * * @return a JSON object builder */ public static JsonObjectBuilder createObjectBuilder() { return JsonProvider.provider().createObjectBuilder(); }
/** * Creates a generator factory for creating {@link JsonGenerator} objects. * The factory is configured with the specified map of provider specific * configuration properties. Provider implementations should ignore any * unsupported configuration properties specified in the map. * * @param config a map of provider specific properties to configure the * JSON generators. The map may be empty or null * @return JSON generator factory */ public static JsonGeneratorFactory createGeneratorFactory( Map<String, ?> config) { return JsonProvider.provider().createGeneratorFactory(config); }
/** * Creates a reader factory for creating {@link JsonReader} objects. * The factory is configured with the specified map of provider specific * configuration properties. Provider implementations should ignore any * unsupported configuration properties specified in the map. * * @param config a map of provider specific properties to configure the * JSON readers. The map may be empty or null * @return a JSON reader factory */ public static JsonReaderFactory createReaderFactory(Map<String, ?> config) { return JsonProvider.provider().createReaderFactory(config); }
/** * Creates a JSON generator for writing JSON to a byte stream. * * @param out i/o stream to which JSON is written * @return a JSON generator */ public static JsonGenerator createGenerator(OutputStream out) { return JsonProvider.provider().createGenerator(out); }
/** * Creates a JSON array builder * * @return a JSON array builder */ public static JsonArrayBuilder createArrayBuilder() { return JsonProvider.provider().createArrayBuilder(); }
/** * Creates a JSON reader from a byte stream. The character encoding of * the stream is determined as described in * <a href="http://tools.ietf.org/rfc/rfc7159.txt">RFC 7159</a>. * * @param in a byte stream from which JSON is to be read * @return a JSON reader */ public static JsonReader createReader(InputStream in) { return JsonProvider.provider().createReader(in); }
/** Constructor. */ public CollectionSerializer() { final JsonProvider provider = JsonProvider.provider(); generatorFactory = provider.createGeneratorFactory(null); readerFactory = provider.createReaderFactory(null); }
/** * Creates a writer factory for creating {@link JsonWriter} objects. * The factory is configured with the specified map of provider specific * configuration properties. Provider implementations should ignore any * unsupported configuration properties specified in the map. * * @param config a map of provider specific properties to configure the * JSON writers. The map may be empty or null * @return a JSON writer factory */ public static JsonWriterFactory createWriterFactory(Map<String, ?> config) { return JsonProvider.provider().createWriterFactory(config); }
/** * Creates a parser factory for creating {@link JsonParser} objects. * The factory is configured with the specified map of provider specific * configuration properties. Provider implementations should ignore any * unsupported configuration properties specified in the map. * * @param config a map of provider specific properties to configure the * JSON parsers. The map may be empty or null * @return JSON parser factory */ public static JsonParserFactory createParserFactory(Map<String, ?> config) { return JsonProvider.provider().createParserFactory(config); }
/** * Creates a builder factory for creating {@link JsonArrayBuilder} * and {@link JsonObjectBuilder} objects. * The factory is configured with the specified map of provider specific * configuration properties. Provider implementations should ignore any * unsupported configuration properties specified in the map. * * @param config a map of provider specific properties to configure the * JSON builders. The map may be empty or null * @return a JSON builder factory */ public static JsonBuilderFactory createBuilderFactory( Map<String, ?> config) { return JsonProvider.provider().createBuilderFactory(config); }
/** * Creates a JSON writer to write a * JSON {@link JsonObject object} or {@link JsonArray array} * structure to the specified character stream. * * @param writer to which JSON object or array is written * @return a JSON writer */ public static JsonWriter createWriter(Writer writer) { return JsonProvider.provider().createWriter(writer); }
/** * Creates a JsonNumber. * * @param value a JSON number * @return the JsonNumber for the number * * @since 1.1 */ public static JsonNumber createValue(long value) { return JsonProvider.provider().createValue(value); }
/** * Creates a JSON Patch builder (<a href="http://tools.ietf.org/html/rfc6902">RFC 6902</a>). * * @return a JSON Patch builder * * @since 1.1 */ public static JsonPatchBuilder createPatchBuilder() { return JsonProvider.provider().createPatchBuilder(); }
public static JsonGeneratorFactory createGeneratorFactory(Map<String, ?> config) { return provider.createGeneratorFactory(config); }
public UsersJsonProvider() { jacksonAfterburner.registerModule(new AfterburnerModule()); jsonioStreamOptions.put(JsonReader.USE_MAPS, true); jsonioStreamOptions.put(JsonWriter.TYPE, false); // set johnson JsonReader (default is `JsonProvider.provider()`) javax.json.spi.JsonProvider johnzonProvider = new JsonProviderImpl(); johnzon = new org.apache.johnzon.mapper.MapperBuilder() .setReaderFactory(johnzonProvider.createReaderFactory(Collections.emptyMap())) .setGeneratorFactory(johnzonProvider.createGeneratorFactory(Collections.emptyMap())) .setAccessModeName("field") // default is "strict-method" which doesn't work nicely with public attributes .build(); }
public static JsonBuilderFactory createBuilderFactory(Map<String, ?> config) { return provider.createBuilderFactory(config); }
private JsonGenerator writerGenerator(Writer writer) { Map<String, ?> factoryProperties = createJsonpProperties(jsonbContext.getConfig()); if (factoryProperties.isEmpty()) { return jsonbContext.getJsonProvider().createGenerator(writer); } return jsonbContext.getJsonProvider().createGeneratorFactory(factoryProperties).createGenerator(writer); }
public static JsonWriterFactory createWriterFactory(Map<String, ?> config) { return provider.createWriterFactory(config); }
public static JsonParserFactory createParserFactory(Map<String, ?> config) { return provider.createParserFactory(config); }
@Override public JsonProvider run() { ClassLoader originalLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(JsonLoader.class.getClassLoader()); return JsonProvider.provider(); } finally { Thread.currentThread().setContextClassLoader(originalLoader); } } });