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