Search in sources :

Example 1 with IonGenerator

use of com.fasterxml.jackson.dataformat.ion.IonGenerator in project jackson-dataformats-binary by FasterXML.

the class IonValueSerializer method serialize.

@Override
public void serialize(IonValue value, JsonGenerator g, SerializerProvider provider) {
    IonGenerator joiGenerator = (IonGenerator) g;
    joiGenerator.writeValue(value);
}
Also used : IonGenerator(com.fasterxml.jackson.dataformat.ion.IonGenerator)

Example 2 with IonGenerator

use of com.fasterxml.jackson.dataformat.ion.IonGenerator in project jackson-dataformats-binary by FasterXML.

the class TimestampSerializer method serialize.

@Override
public void serialize(Timestamp value, JsonGenerator jgen, SerializerProvider provider) {
    IonGenerator joiGenerator = (IonGenerator) jgen;
    joiGenerator.writeValue(value);
}
Also used : IonGenerator(com.fasterxml.jackson.dataformat.ion.IonGenerator)

Example 3 with IonGenerator

use of com.fasterxml.jackson.dataformat.ion.IonGenerator in project jackson-dataformats-binary by FasterXML.

the class IonTimestampInstantSerializer method serialize.

@Override
public void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws JacksonException {
    final Instant instant = getInstant.apply(value);
    if (provider.isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)) {
        if (shouldWriteTimestampsAsNanos(provider)) {
            gen.writeNumber(TimestampUtils.getFractionalSeconds(instant));
        } else {
            gen.writeNumber(instant.toEpochMilli());
        }
    } else {
        final ZoneOffset offset = getOffset(value);
        ((IonGenerator) gen).writeValue(TimestampUtils.toTimestamp(instant, offset));
    }
}
Also used : Instant(java.time.Instant) IonGenerator(com.fasterxml.jackson.dataformat.ion.IonGenerator) ZoneOffset(java.time.ZoneOffset)

Example 4 with IonGenerator

use of com.fasterxml.jackson.dataformat.ion.IonGenerator in project amazon-qldb-dmv-sample-java by aws-samples.

the class IonLocalDateSerializer method serialize.

@Override
public void serialize(LocalDate date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
    Timestamp timestamp = Timestamp.forDay(date.getYear(), date.getMonthValue(), date.getDayOfMonth());
    ((IonGenerator) jsonGenerator).writeValue(timestamp);
}
Also used : IonGenerator(com.fasterxml.jackson.dataformat.ion.IonGenerator) Timestamp(com.amazon.ion.Timestamp)

Aggregations

IonGenerator (com.fasterxml.jackson.dataformat.ion.IonGenerator)4 Timestamp (com.amazon.ion.Timestamp)1 Instant (java.time.Instant)1 ZoneOffset (java.time.ZoneOffset)1