Class AbstractPatternBasedConverter<T,P>
java.lang.Object
com.github.hypfvieh.cli.parser.converter.AbstractPatternBasedConverter<T,P>
- All Implemented Interfaces:
IValueConverter<T>
- Direct Known Subclasses:
DoubleConverter,LocalDateConverter,LocalDateTimeConverter,LocalTimeConverter
public abstract class AbstractPatternBasedConverter<T,P>
extends Object
implements IValueConverter<T>
Base converter using a list of patterns to find a suitable convert operation.
Allows adding additional number patterns by using addPattern(P).
Will use the first pattern which successfully parsed the input string.
- Since:
- 1.0.0 - 2022-05-05
- Author:
- David M., Markus S.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPattern(P _pattern) Adds a pattern.protected org.slf4j.LoggerAccess to the logger for subclass objects.Returns the list of patternsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.hypfvieh.cli.parser.converter.IValueConverter
convert
-
Constructor Details
-
AbstractPatternBasedConverter
public AbstractPatternBasedConverter()
-
-
Method Details
-
addPattern
Adds a pattern.- Parameters:
_pattern- pattern
-
getLogger
protected org.slf4j.Logger getLogger()Access to the logger for subclass objects.- Returns:
- logger
-
getPatterns
Returns the list of patterns- Returns:
- patterns
-