Package dev.orne.beans.converters
Class PeriodConverter
java.lang.Object
org.apache.commons.beanutils.converters.AbstractConverter
dev.orne.beans.converters.PeriodConverter
- All Implemented Interfaces:
org.apache.commons.beanutils.Converter
@API(status=STABLE,
since="0.1")
public class PeriodConverter
extends org.apache.commons.beanutils.converters.AbstractConverter
Implementation of
Converter
that converts Period
instances
to and from String
using ISO-8601 as String
representation.- Since:
- 0.1
- Version:
- 1.0, 2020-05
- Author:
- (w) Iker Hernaez
-
Constructor Summary
ConstructorDescriptionCreates a new instance that throws aConversionException
if an error occurs.PeriodConverter
(Period defaultValue) Creates a new instance that returns a default value if an error occurs. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
convertToString
(Object value) protected <T> T
convertToType
(@NotNull Class<T> type, Object value) protected @NotNull Class<?>
Methods inherited from class org.apache.commons.beanutils.converters.AbstractConverter
conversionException, convert, convertArray, getDefault, handleError, handleMissing, isUseDefault, setDefaultValue, toString
-
Constructor Details
-
PeriodConverter
public PeriodConverter()Creates a new instance that throws aConversionException
if an error occurs. -
PeriodConverter
Creates a new instance that returns a default value if an error occurs.- Parameters:
defaultValue
- The default value to be returned if the value to be converted is missing or an error occurs converting the value
-
-
Method Details
-
getDefaultType
- Specified by:
getDefaultType
in classorg.apache.commons.beanutils.converters.AbstractConverter
-
convertToType
- Specified by:
convertToType
in classorg.apache.commons.beanutils.converters.AbstractConverter
- Throws:
Throwable
-
convertToString
- Overrides:
convertToString
in classorg.apache.commons.beanutils.converters.AbstractConverter
- Throws:
Throwable
-