Skip to content

Commit

Permalink
ExpiresAtDeserializer extends StdDeserializer
Browse files Browse the repository at this point in the history
  • Loading branch information
yvasyliev committed Dec 31, 2023
1 parent ce89722 commit dffee5c
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;

public class ExpiresAtDeserializer extends JsonDeserializer<LocalDateTime> {
public class ExpiresAtDeserializer extends StdDeserializer<LocalDateTime> {
protected ExpiresAtDeserializer() {
super(LocalDateTime.class);
}

@Override
public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException {
return LocalDateTime.now().plus(jsonParser.getLongValue(), ChronoUnit.MILLIS);
Expand Down

0 comments on commit dffee5c

Please sign in to comment.