public class TypeConversionRegister extends Object
| Modifier and Type | Field and Description |
|---|---|
static DateTimeFormatter[] |
DATE_TIME_FORMATTERS
An array of
DateTimeFormatters that can be used to parse and format dates. |
static String |
LINE_SEPARATOR |
static Map<Class<?>,Map<Class<?>,FunctionOrNull>> |
TYPE_CONVERSIONS
A map where the key is the target type and the value is another map.
|
| Modifier and Type | Method and Description |
|---|---|
static Calendar |
calendarOf(Date date) |
static Calendar |
calendarOf(LocalTime localTime) |
static Calendar |
calendarOf(long timeInMs) |
static <S,T> void |
registerTypeConvert(Class<S> sourceType,
Class<T> targetType,
FunctionOrNull<S,T> conversion)
Registers a conversion function that can convert an object of the source type
to the target type.
|
static String |
stringOf(Throwable throwable) |
static <T> T |
temporalOf(String string,
Function<TemporalAccessor,T> converter) |
public static final Map<Class<?>,Map<Class<?>,FunctionOrNull>> TYPE_CONVERSIONS
public static final DateTimeFormatter[] DATE_TIME_FORMATTERS
DateTimeFormatters that can be used to parse and format dates.
The formatters are listed in a specific order to handle the most complex formats first,
eventually falling back to simpler formats. This order ensures the highest accuracy when
parsing date strings that may be in various formats.public static final String LINE_SEPARATOR
public static <S,T> void registerTypeConvert(Class<S> sourceType, Class<T> targetType, FunctionOrNull<S,T> conversion)
S - The source type.T - The target type.sourceType - The class of the source type.targetType - The class of the target type.conversion - The function that will perform the conversion.public static <T> T temporalOf(String string, Function<TemporalAccessor,T> converter)
public static Calendar calendarOf(long timeInMs)
Copyright © 2023. All rights reserved.