use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project jackson-core by FasterXML.
the class TestPrettyPrinter method testCustomSeparatorsWithPPWithoutSpaces.
public void testCustomSeparatorsWithPPWithoutSpaces() throws Exception {
StringWriter sw = new StringWriter();
JsonGenerator gen = new JsonFactory().createGenerator(ObjectWriteContext.empty(), sw);
gen.setPrettyPrinter(new DefaultPrettyPrinter().withSeparators(Separators.createDefaultInstance().withObjectFieldValueSeparator('=').withObjectEntrySeparator(';').withArrayValueSeparator('|')).withoutSpacesInObjectEntries());
_writeTestDocument(gen);
gen.close();
assertEquals("[ 3| \"abc\"| [ true ]| {" + DefaultIndenter.SYS_LF + " \"f\"=null;" + DefaultIndenter.SYS_LF + " \"f2\"=null" + DefaultIndenter.SYS_LF + "} ]", sw.toString());
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project jackson-core by FasterXML.
the class TestPrettyPrinter method testCustomSeparatorsWithPP.
public void testCustomSeparatorsWithPP() throws Exception {
StringWriter sw = new StringWriter();
JsonGenerator gen = new JsonFactory().createGenerator(ObjectWriteContext.empty(), sw);
gen.setPrettyPrinter(new DefaultPrettyPrinter().withSeparators(Separators.createDefaultInstance().withObjectFieldValueSeparator('=').withObjectEntrySeparator(';').withArrayValueSeparator('|')));
_writeTestDocument(gen);
gen.close();
assertEquals("[ 3| \"abc\"| [ true ]| {" + DefaultIndenter.SYS_LF + " \"f\" = null;" + DefaultIndenter.SYS_LF + " \"f2\" = null" + DefaultIndenter.SYS_LF + "} ]", sw.toString());
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project webprotege by protegeproject.
the class GetFormDescriptorActionHander method getDummy.
private GetFormDescriptorResult getDummy(CollectionId collectionId, FormId formId, CollectionItem elementId) {
try {
URL url = GetFormDescriptorActionHander.class.getResource("/amino-acid-form.json");
System.out.println(url);
InputStream is = GetFormDescriptorActionHander.class.getResourceAsStream("/amino-acid-form.json");
ObjectMapper mapper = new ObjectMapper();
SimpleModule module = new SimpleModule();
module.addDeserializer(FormDataValue.class, new FormDataValueDeserializer(dataFactory));
mapper.registerModule(module);
mapper.setDefaultPrettyPrinter(new DefaultPrettyPrinter());
FormDescriptor d = mapper.readerFor(FormDescriptor.class).readValue(new BufferedInputStream(is));
is.close();
CollectionItemData formData = repository.find(collectionId, elementId);
return new GetFormDescriptorResult(projectId, collectionId, elementId, formId, d, formData.getFormData().orElse(FormData.empty()));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project rdf4j by eclipse.
the class RDFJSONWriter method modelToRdfJsonInternal.
public static void modelToRdfJsonInternal(final Model graph, final WriterConfig writerConfig, final JsonGenerator jg) throws IOException, JsonGenerationException {
if (writerConfig.get(BasicWriterSettings.PRETTY_PRINT)) {
// SES-2011: Always use \n for consistency
Indenter indenter = DefaultIndenter.SYSTEM_LINEFEED_INSTANCE;
// By default Jackson does not pretty print, so enable this unless
// PRETTY_PRINT setting is disabled
DefaultPrettyPrinter pp = new DefaultPrettyPrinter().withArrayIndenter(indenter).withObjectIndenter(indenter);
jg.setPrettyPrinter(pp);
}
jg.writeStartObject();
for (final Resource nextSubject : graph.subjects()) {
jg.writeObjectFieldStart(RDFJSONWriter.resourceToString(nextSubject));
for (final IRI nextPredicate : graph.filter(nextSubject, null, null).predicates()) {
jg.writeArrayFieldStart(nextPredicate.stringValue());
for (final Value nextObject : graph.filter(nextSubject, nextPredicate, null).objects()) {
// contexts are optional, so this may return empty in some
// scenarios depending on the interpretation of the way contexts
// work
final Set<Resource> contexts = graph.filter(nextSubject, nextPredicate, nextObject).contexts();
RDFJSONWriter.writeObject(nextObject, contexts, jg);
}
jg.writeEndArray();
}
jg.writeEndObject();
}
jg.writeEndObject();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project solr-document-store by DBCDK.
the class SolrWorker method init.
@PostConstruct
public void init() {
log.info("Initializing SolrWorker");
onMessageTimer = registry.getRegistry().timer(MetricRegistry.name(SolrWorker.class, "onMessage"));
solrDocStoreTimer = registry.getRegistry().timer(MetricRegistry.name(SolrWorker.class, "solrDocStore"));
log.info("solrDocStoreUrl = {}", solrDocStoreUrl);
this.client = HttpClientBuilder.create().build();
this.printer = prettyPrintJson ? O.writer(new DefaultPrettyPrinter()) : O.writer();
}
Aggregations