com.github.ngeor.yak4j.LocalDateTimeConverter Maven / Gradle / Ivy
The newest version!
package com.github.ngeor.yak4j;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter;
import java.time.LocalDateTime;
/**
* Converts a {@link java.time.LocalDateTime} to a string and back.
* Null values are preserved as null.
*/
public class LocalDateTimeConverter implements DynamoDBTypeConverter {
@Override
public String convert(LocalDateTime object) {
return object == null ? null : object.toString();
}
@Override
public LocalDateTime unconvert(String object) {
return object == null ? null : LocalDateTime.parse(object);
}
}