Introduce support to pass-thru TemporalAccessor auditing values.

We now allow passing-thru TemporalAccessor auditing values, bypassing conversion if the target value type matches the value provided from e.g. DateTimeProvider.

Refined the error messages and listing all commonly supported types for which we provide converters.

Closes #2719
Original pull request #2874
This commit is contained in:
Mark Paluch
2023-07-12 12:22:59 +02:00
committed by Jens Schauder
parent f2387f687a
commit d0ba125268
6 changed files with 113 additions and 19 deletions

View File

@@ -30,6 +30,7 @@ import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -82,10 +83,17 @@ public abstract class Jsr310Converters {
}
public static boolean supports(Class<?> type) {
return CLASSES.contains(type);
}
/**
* @return the collection of supported temporal classes.
* @since 3.2
*/
public static Collection<Class<?>> getSupportedClasses() {
return Collections.unmodifiableList(CLASSES);
}
@ReadingConverter
public enum DateToLocalDateTimeConverter implements Converter<Date, LocalDateTime> {