private static JsonWriterFactory writerFactory(Map<String, ?> jsonPConfig) { return Json.createWriterFactory(jsonPConfig); }
private static JsonWriterFactory writerFactory(Map<String, ?> jsonPConfig) { return Json.createWriterFactory(jsonPConfig); }
private static JsonWriterFactory newWriterFactory() { return Json.createWriterFactory(Collections.<String, Object>emptyMap()); } }
private static JsonWriterFactory newWriterFactory() { return Json.createWriterFactory(Collections.<String, Object>emptyMap()); } }
public JsrMessageBodyWriter() { this(Json.createWriterFactory(Collections.<String, Object>emptyMap()), false); }
private static JsonWriterFactory createPrettyWriterFactory() { HashMap<String, Object> prettyConfigMap = new HashMap<String, Object>(); prettyConfigMap.put(JsonGenerator.PRETTY_PRINTING, Boolean.TRUE); JsonWriterFactory prettyWriterFactory = Json.createWriterFactory(prettyConfigMap); return prettyWriterFactory; }
private static JsonWriterFactory createPrettyWriterFactory() { HashMap<String, Object> prettyConfigMap = new HashMap<String, Object>(); prettyConfigMap.put(JsonGenerator.PRETTY_PRINTING, Boolean.TRUE); JsonWriterFactory prettyWriterFactory = Json.createWriterFactory(prettyConfigMap); return prettyWriterFactory; }
/** * Creates an mbean bound to the given configuration. This is useful, when multiple mbeans for each * context should be used, e.g. one mbean per ear, app deployment. * @param config the configuration to be used. */ public ConfigDocumentationBean(Configuration config){ this.config = config; Map<String, Object> writerProperties = new HashMap<>(1); writerProperties.put(JsonGenerator.PRETTY_PRINTING, true); writerFactory = Json.createWriterFactory(writerProperties); }
@PostConstruct private void init() { wf = Json.createWriterFactory(new HashMap<>()); }
@PostConstruct private void init() { Map<String, Object> props = new HashMap<>(); if (config != null && config.getProperties().containsKey(JsonGenerator.PRETTY_PRINTING)) { props.put(JsonGenerator.PRETTY_PRINTING, true); } wf = Json.createWriterFactory(props); }
@PostConstruct private void init() { Map<String, Object> props = new HashMap<>(); if (config != null && config.getProperties().containsKey(JsonGenerator.PRETTY_PRINTING)) { props.put(JsonGenerator.PRETTY_PRINTING, true); } wf = Json.createWriterFactory(props); }
public String getPrettyPrint(JsonObject jsonObject) throws IOException { Map<String, Boolean> config = new HashMap<String, Boolean>(); config.put(JsonGenerator.PRETTY_PRINTING, true); JsonWriterFactory writerFactory = Json.createWriterFactory(config); String output = null; try (StringWriter sw = new StringWriter(); JsonWriter jsonWriter = writerFactory.createWriter(sw)) { jsonWriter.writeObject(jsonObject); output = sw.toString(); } return output; }
public static String prettyPrint(JsonArray jsonArray) { Map<String, Boolean> config = new HashMap<>(); config.put(JsonGenerator.PRETTY_PRINTING, true); JsonWriterFactory jsonWriterFactory = Json.createWriterFactory(config); StringWriter stringWriter = new StringWriter(); try (JsonWriter jsonWriter = jsonWriterFactory.createWriter(stringWriter)) { jsonWriter.writeArray(jsonArray); } return stringWriter.toString(); }
public static String prettyPrint(javax.json.JsonObject jsonObject) { Map<String, Boolean> config = new HashMap<>(); config.put(JsonGenerator.PRETTY_PRINTING, true); JsonWriterFactory jsonWriterFactory = Json.createWriterFactory(config); StringWriter stringWriter = new StringWriter(); try (JsonWriter jsonWriter = jsonWriterFactory.createWriter(stringWriter)) { jsonWriter.writeObject(jsonObject); } return stringWriter.toString(); }
public String getPrettyPrint(JsonObject jsonObject) throws IOException { Map<String, Boolean> config = new HashMap<String, Boolean>(); config.put(JsonGenerator.PRETTY_PRINTING, true); JsonWriterFactory writerFactory = Json.createWriterFactory(config); String output = null; try (StringWriter sw = new StringWriter(); JsonWriter jsonWriter = writerFactory.createWriter(sw)) { jsonWriter.writeObject(jsonObject); output = sw.toString(); } return output; }
public String getPrettyPrint(JsonObject jsonObject) throws IOException { Map<String, Boolean> config = new HashMap<String, Boolean>(); config.put(JsonGenerator.PRETTY_PRINTING, true); JsonWriterFactory writerFactory = Json.createWriterFactory(config); String output = null; try (StringWriter sw = new StringWriter(); JsonWriter jsonWriter = writerFactory.createWriter(sw)) { jsonWriter.writeObject(jsonObject); output = sw.toString(); } return output; }
private static byte[] serialize(final JsonObject jsonObject) { try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) { final Map<String, ?> config = singletonMap(JsonGenerator.PRETTY_PRINTING, true); final JsonWriter jsonWriter = Json.createWriterFactory(config).createWriter(output); jsonWriter.write(jsonObject); jsonWriter.close(); return output.toByteArray(); } catch (IOException e) { throw new RuntimeException("Could not write Swagger output", e); } }
private static byte[] serialize(final JsonObject jsonObject) { try (final ByteArrayOutputStream output = new ByteArrayOutputStream()) { final Map<String, ?> config = singletonMap(JsonGenerator.PRETTY_PRINTING, true); final JsonWriter jsonWriter = Json.createWriterFactory(config).createWriter(output); jsonWriter.write(jsonObject); jsonWriter.close(); return output.toByteArray(); } catch (IOException e) { throw new RuntimeException("Could not write Swagger output", e); } }
/** * Creates a new instance using the provided configuration. * * @param config A map of provider-specific configuration properties. May be empty or {@code * null}. */ public Jsr353JsonCodec(Map<String, ?> config) { super(DataType.varchar(), JsonStructure.class); readerFactory = Json.createReaderFactory(config); writerFactory = Json.createWriterFactory(config); }
public void reportHealth(OutputStream out, SmallRyeHealth health) { JsonWriterFactory factory = Json.createWriterFactory(JSON_CONFIG); JsonWriter writer = factory.createWriter(out); writer.writeObject(health.getPayload()); writer.close(); }