Package cdc.converters.defaults
Class AbstractStringToTemporal<T extends TemporalAccessor>
- java.lang.Object
-
- cdc.converters.AbstractConverter<String,T>
-
- cdc.converters.defaults.AbstractStringToTemporal<T>
-
- 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 Modifier and Type Class Description protected static classAbstractStringToTemporal.Default
-
Field Summary
Fields Modifier and Type Field Description static FormalArg<DateTimeFormatter>FORMATTERstatic FormalArgsFPARAMS_FORMATTERstatic FormalArgsFPARAMS_PATTERN_LOCALEstatic FormalArg<Locale>LOCALEstatic FormalArg<String>PATTERN-
Fields inherited from interface cdc.converters.Converter
META_FARGS, SOURCE_CLASS, TARGET_CLASS
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractStringToTemporal(Class<T> targetClass)protectedAbstractStringToTemporal(Class<T> targetClass, DateTimeFormatter formatter, String pattern, Locale locale)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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.DateTimeFormattergetFormatter()LocalegetLocale()ArgsgetParams()StringgetPattern()-
Methods inherited from class cdc.converters.AbstractConverter
getSourceClass, getTargetClass, getWrappedSourceClass, getWrappedTargetClass, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cdc.converters.Converter
adapt, andThen, andThenRaw, applyRaw, areCompliantSourceAndTargetClasses, areMatchingSourceAndTargetClasses, cast, compose, composeRaw, isCompliantSourceClass, isCompliantTargetClass, isMatchingSourceClass, isMatchingTargetClass, orElse, orElseRaw
-
-
-
-
Field Detail
-
FORMATTER
public static final FormalArg<DateTimeFormatter> FORMATTER
-
FPARAMS_FORMATTER
public static final FormalArgs FPARAMS_FORMATTER
-
FPARAMS_PATTERN_LOCALE
public static final FormalArgs FPARAMS_PATTERN_LOCALE
-
-
Method Detail
-
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
public final DateTimeFormatter getFormatter()
-
getPattern
public final String getPattern()
-
getLocale
public final Locale getLocale()
-
getParams
public final Args getParams()
- Returns:
- The parameters used to configure this converter.
-
apply
protected T apply(String source, BiFunction<String,DateTimeFormatter,T> parser, AbstractStringToTemporal.Default[] defaults)
-
-