
com.figtreelake.util.time.zoned.serializer.epoch.ZonedDateTimeFromEpochUtcDeserializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of util Show documentation
Show all versions of util Show documentation
A series of useful classes and methods which helps on minor tasks.
The newest version!
package com.figtreelake.util.time.zoned.serializer.epoch;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.figtreelake.util.time.zoned.ZonedDateTimeUtil;
import java.io.IOException;
import java.time.ZonedDateTime;
/**
*
* A {@link StdDeserializer} deserializes epoch time on UTC zone offset to {@link ZonedDateTime} a
* object.
*
*
* Its serialization equivalent can be found on {@link ZonedDateTimeToEpochUtcSerializer} class.
*
*
* @author MarceloLeite2604
*
*/
public class ZonedDateTimeFromEpochUtcDeserializer extends StdDeserializer {
private static final long serialVersionUID = 1L;
private final transient ZonedDateTimeUtil zonedDateTimeUtil;
public ZonedDateTimeFromEpochUtcDeserializer() {
super(ZonedDateTime.class);
this.zonedDateTimeUtil = new ZonedDateTimeUtil();
}
@Override
public ZonedDateTime deserialize(JsonParser jsonParser, DeserializationContext context)
throws IOException {
return zonedDateTimeUtil.convertFromEpochTimeToUtcOffset(jsonParser.getValueAsLong());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy