Package cdc.converters.defaults
Class AbstractStringToTemporal<T extends TemporalAccessor>
- Type Parameters:
T- The temporal type.
- Direct Known Subclasses:
StringToLocalDate,StringToLocalDateTime,StringToLocalTime
public abstract class AbstractStringToTemporal<T extends TemporalAccessor>
extends AbstractConverter<String,T>
Base class used to create String to Temporal converters.
- Author:
- Damien Carbonne
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final FormalArg<DateTimeFormatter>static final FormalArgsstatic final FormalArgsFields inherited from interface cdc.converters.Converter
META_FARGS, SOURCE_CLASS, TARGET_CLASS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractStringToTemporal(Class<T> targetClass) protectedAbstractStringToTemporal(Class<T> targetClass, DateTimeFormatter formatter, String pattern, Locale locale) -
Method Summary
Modifier and TypeMethodDescriptionprotected Tapply(String source, BiFunction<String, DateTimeFormatter, T> parser, AbstractStringToTemporal.Default[] defaults) protected static <C extends AbstractStringToTemporal<T>,T extends TemporalAccessor>
Factory<C>factory(Class<C> converterClass, Class<T> temporalClass, C autoConverter, Function<DateTimeFormatter, C> builderFormatter, BiFunction<String, Locale, C> builderPatternLocale) Function used to create a String to Temporal converter Factory.final DateTimeFormatterfinal Localefinal Argsfinal StringMethods inherited from class cdc.converters.AbstractConverter
getSourceClass, getTargetClass, getWrappedSourceClass, getWrappedTargetClass, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface cdc.converters.Converter
adapt, andThen, andThenRaw, applyRaw, areCompliantSourceAndTargetClasses, areMatchingSourceAndTargetClasses, cast, compose, composeRaw, isCompliantSourceClass, isCompliantTargetClass, isMatchingSourceClass, isMatchingTargetClass, orElse, orElseRaw
-
Field Details
-
FORMATTER
-
FPARAMS_FORMATTER
-
PATTERN
-
LOCALE
-
FPARAMS_PATTERN_LOCALE
-
-
Constructor Details
-
AbstractStringToTemporal
-
AbstractStringToTemporal
protected AbstractStringToTemporal(Class<T> targetClass, DateTimeFormatter formatter, String pattern, Locale locale)
-
-
Method Details
-
factory
protected static <C extends AbstractStringToTemporal<T>,T extends TemporalAccessor> Factory<C> factory(Class<C> converterClass, Class<T> temporalClass, C autoConverter, Function<DateTimeFormatter, C> builderFormatter, BiFunction<String, Locale, C> builderPatternLocale) Function used to create a String to Temporal converter Factory.- Type Parameters:
C- The converter type.T- The temporal type.- Parameters:
converterClass- The converter class.temporalClass- The temporal class.autoConverter- The auto converter.builderFormatter- The creation function that uses a DateTimeFormatter.builderPatternLocale- The creation function that uses a pattern and a locale.- Returns:
- A converter Factory.
-
getFormatter
-
getPattern
-
getLocale
-
getParams
- Returns:
- The parameters used to configure this converter.
-
apply
protected T apply(String source, BiFunction<String, DateTimeFormatter, T> parser, AbstractStringToTemporal.Default[] defaults)
-