Description
Hi, wanted to ask if this library can support the java.time.YearMonth class as a custom date converters. This object is very useful for storing credit card expiration dates that only require year and month with no other time unit. We have been using all of the out of box converters and this is the only one we have left that requires us to implement our own custom converter and think it would be useful for other users. This is what we have and then override customConversions() in the AbstractCouchbaseConfiguration class. Many thanks for considering it!
@WritingConverter
public enum YearMonthToStringConverter implements Converter<YearMonth, String> {
INSTANCE;
@Override
public String convert(YearMonth source) {
return Optional.ofNullable(source).map(YearMonth::toString).orElse(null);
}
}
@ReadingConverter
public enum StringToYearMonthConverter implements Converter<String, YearMonth> {
INSTANCE;
@Override
public YearMonth convert(String source) {
return Optional.ofNullable(source).map(YearMonth::parse).orElse(null);
}
}