Java Code Examples for com.fasterxml.jackson.databind.SerializerProvider#defaultSerializeValue()
The following examples show how to use
com.fasterxml.jackson.databind.SerializerProvider#defaultSerializeValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProgramTracer.java From yql-plus with Apache License 2.0 | 6 votes |
private void writeTraceEntries(JsonGenerator jgen, SerializerProvider provider, Multimap<Integer, TraceEntry> childmap, Multimap<Integer, TraceLogEntry> logmap, Collection<TraceEntry> traceEntries) throws IOException { if (traceEntries.isEmpty()) { return; } jgen.writeArrayFieldStart("trace"); for (TraceEntry entry : traceEntries) { jgen.writeStartObject(); jgen.writeStringField("group", entry.getGroup()); jgen.writeStringField("name", entry.getName()); jgen.writeNumberField("start", TimeUnit.MICROSECONDS.convert(entry.getStartTicks(), entry.getTickUnits())); jgen.writeNumberField("end", TimeUnit.MICROSECONDS.convert(entry.getEndTicks(), entry.getTickUnits())); jgen.writeNumberField("duration", TimeUnit.MICROSECONDS.convert(entry.getDurationTicks(), entry.getTickUnits())); Collection<TraceLogEntry> log = logmap.get(entry.getId()); if (!log.isEmpty()) { jgen.writeArrayFieldStart("log"); for (TraceLogEntry logEntry : log) { provider.defaultSerializeValue(logEntry, jgen); } jgen.writeEndArray(); } writeTraceEntries(jgen, provider, childmap, logmap, childmap.get(entry.getId())); jgen.writeEndObject(); } jgen.writeEndArray(); }
Example 2
Source File: CumulativeTimeBucketJSONSerializer.java From floodlight_with_topoguard with Apache License 2.0 | 6 votes |
/** * Performs the serialization of a OneComponentTime object */ @Override public void serialize(CumulativeTimeBucket ctb, JsonGenerator jGen, SerializerProvider serializer) throws IOException, JsonProcessingException { jGen.writeStartObject(); Timestamp ts = new Timestamp(ctb.getStartTimeNs()/1000000); jGen.writeStringField("start-time", ts.toString()); jGen.writeStringField("current-time", new Timestamp(System.currentTimeMillis()).toString()); jGen.writeNumberField("total-packets", ctb.getTotalPktCnt()); jGen.writeNumberField("average", ctb.getAverageProcTimeNs()); jGen.writeNumberField("min", ctb.getMinTotalProcTimeNs()); jGen.writeNumberField("max", ctb.getMaxTotalProcTimeNs()); jGen.writeNumberField("std-dev", ctb.getTotalSigmaProcTimeNs()); jGen.writeArrayFieldStart("modules"); for (OneComponentTime oct : ctb.getModules()) { serializer.defaultSerializeValue(oct, jGen); } jGen.writeEndArray(); jGen.writeEndObject(); }
Example 3
Source File: OptionValueSerializer.java From microprofile-starter with Apache License 2.0 | 5 votes |
@Override public void serialize(OptionValue optionValue, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { if (optionValue.isMultipleValues()) { serializerProvider.defaultSerializeValue(optionValue.getValues(), jsonGenerator); } else { jsonGenerator.writeString(optionValue.getSingleValue()); } }
Example 4
Source File: PageJsonSerializer.java From spring-microservice-sample with GNU General Public License v3.0 | 5 votes |
@Override public void serialize(PageImpl value, JsonGenerator gen, SerializerProvider serializers) throws IOException, JsonProcessingException { gen.writeStartObject(); gen.writeNumberField("number", value.getNumber()); gen.writeNumberField("numberOfElements", value.getNumberOfElements()); gen.writeNumberField("totalElements", value.getTotalElements()); gen.writeNumberField("totalPages", value.getTotalPages()); gen.writeNumberField("size", value.getSize()); gen.writeFieldName("content"); serializers.defaultSerializeValue(value.getContent(), gen); gen.writeEndObject(); }
Example 5
Source File: Mixed.java From syndesis with Apache License 2.0 | 5 votes |
@Override public void serialize(final Mixed mixed, final JsonGenerator gen, final SerializerProvider serializers) throws IOException, JsonProcessingException { gen.writeStartObject(); for (final Object part : mixed.parts) { serializers.defaultSerializeValue(part, new EnclosedJsonGenerator(gen)); } gen.writeEndObject(); }
Example 6
Source File: AwsModule.java From beam with Apache License 2.0 | 5 votes |
@Override public void serialize( AWSCredentialsProvider credentialsProvider, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException { serializers.defaultSerializeValue(credentialsProvider, jsonGenerator); }
Example 7
Source File: AwsModule.java From beam with Apache License 2.0 | 5 votes |
@Override public void serialize( AwsCredentialsProvider credentialsProvider, JsonGenerator jsonGenerator, SerializerProvider serializer) throws IOException { serializer.defaultSerializeValue(credentialsProvider, jsonGenerator); }
Example 8
Source File: WrappedBean.java From logsniffer with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void serializeWithType(WrappedBean<ConfiguredBean> value, JsonGenerator jgen, SerializerProvider provider, TypeSerializer typeSer) throws IOException, JsonProcessingException { provider.defaultSerializeValue(value.getWrapped(), jgen); }
Example 9
Source File: DeviceSerializer.java From floodlight_with_topoguard with Apache License 2.0 | 5 votes |
@Override public void serialize(Device device, JsonGenerator jGen, SerializerProvider serializer) throws IOException, JsonProcessingException { jGen.writeStartObject(); jGen.writeStringField("entityClass", device.getEntityClass().getName()); jGen.writeArrayFieldStart("mac"); jGen.writeString(HexString.toHexString(device.getMACAddress(), 6)); jGen.writeEndArray(); jGen.writeArrayFieldStart("ipv4"); for (Integer ip : device.getIPv4Addresses()) jGen.writeString(IPv4.fromIPv4Address(ip)); jGen.writeEndArray(); jGen.writeArrayFieldStart("vlan"); for (Short vlan : device.getVlanId()) if (vlan >= 0) jGen.writeNumber(vlan); jGen.writeEndArray(); jGen.writeArrayFieldStart("attachmentPoint"); for (SwitchPort ap : device.getAttachmentPoints(true)) { serializer.defaultSerializeValue(ap, jGen); } jGen.writeEndArray(); jGen.writeNumberField("lastSeen", device.getLastSeen().getTime()); String dhcpClientName = device.getDHCPClientName(); if (dhcpClientName != null) { jGen.writeStringField("dhcpClientName", dhcpClientName); } jGen.writeEndObject(); }
Example 10
Source File: MultimapSerializer.java From brooklyn-server with Apache License 2.0 | 5 votes |
private void writeEntries(Multimap<?, ?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException { for (Map.Entry<?, ? extends Collection<?>> entry : value.asMap().entrySet()) { provider.findKeySerializer(provider.constructType(Object.class), null) .serialize(entry.getKey(), jgen, provider); provider.defaultSerializeValue(Lists.newArrayList(entry.getValue()), jgen); } }
Example 11
Source File: ReflectiveRecordSerialiser.java From octarine with Apache License 2.0 | 5 votes |
@Override public void serialize(Record o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { jsonGenerator.writeStartObject(); for (Map.Entry<Key<?>, Object> entry : o.values().entrySet()) { jsonGenerator.writeFieldName(entry.getKey().name()); serializerProvider.defaultSerializeValue(entry.getValue(), jsonGenerator); } jsonGenerator.writeEndObject(); }
Example 12
Source File: DMNFEELComparablePeriodSerializer.java From kogito-runtimes with Apache License 2.0 | 4 votes |
@Override public void serialize(ComparablePeriod v, JsonGenerator g, SerializerProvider sp) throws IOException { sp.defaultSerializeValue(v.asPeriod(), g); }
Example 13
Source File: JacksonConfig.java From joal with Apache License 2.0 | 4 votes |
@Override public void serialize(final LocalDateTime value, final JsonGenerator gen, final SerializerProvider serializers) throws IOException { final ZonedDateTime zonedDateTime = value.atZone(ZoneId.systemDefault()); serializers.defaultSerializeValue(zonedDateTime, gen); }
Example 14
Source File: IdentifiableSerializer.java From cloudstreetmarket.com with GNU General Public License v3.0 | 4 votes |
@Override public void serialize(Identifiable<?> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { provider.defaultSerializeValue(value.getId(), jgen); }
Example 15
Source File: WrappedBean.java From logsniffer with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void serialize(WrappedBean<ConfiguredBean> value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { provider.defaultSerializeValue(value.getWrapped(), jgen); }
Example 16
Source File: ApplicationException.java From joynr with Apache License 2.0 | 4 votes |
@Override public void serialize(Enum value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonGenerationException { provider.defaultSerializeValue(value, jgen); }