Klasse DurationConverter

java.lang.Object
org.apache.commons.beanutils.converters.AbstractConverter
org.apache.torque.dsfactory.converters.DurationConverter
Alle implementierten Schnittstellen:
org.apache.commons.beanutils.Converter

public final class DurationConverter extends org.apache.commons.beanutils.converters.AbstractConverter
Converter implementation that handles conversion to and from java.time.Duration objects.

Can be configured to either return a default value or throw a ConversionException if a conversion error occurs.

Seit:
1.3
Version:
$Id$
  • Konstruktorübersicht

    Konstruktoren
    Konstruktor
    Beschreibung
    Construct a java.time.Duration Converter that throws a ConversionException if an error occurs.
    DurationConverter(boolean useTextFormat)
    Construct a java.time.DurationL Converter that throws a ConversionException if an error occurs.
    DurationConverter(Object defaultValue)
    Construct a java.time.DurationL Converter that returns a default value if an error occurs.
    DurationConverter(Object defaultValue, boolean useTextFormat)
    Construct a java.time.DurationL Converter that returns a default value if an error occurs.
  • Methodenübersicht

    Modifizierer und Typ
    Methode
    Beschreibung
    protected <T> T
    convertToType(Class<T> type, Object value)
    Convert a String to a java.time.Duration.
    protected Class<?>
    Return the default type this Converter handles.

    Von Klasse geerbte Methoden org.apache.commons.beanutils.converters.AbstractConverter

    conversionException, convert, convertArray, convertToString, getDefault, handleError, handleMissing, isUseDefault, setDefaultValue, toString

    Von Klasse geerbte Methoden java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Konstruktordetails

    • DurationConverter

      public DurationConverter()
      Construct a java.time.Duration Converter that throws a ConversionException if an error occurs.
    • DurationConverter

      public DurationConverter(Object defaultValue, boolean useTextFormat)
      Construct a java.time.DurationL Converter that returns a default value if an error occurs.
      Parameter:
      defaultValue - The default value to be returned if the value to be converted is missing or an error occurs converting the value.
      useTextFormat - if values are in ISO8901 formats.
    • DurationConverter

      public DurationConverter(Object defaultValue)
      Construct a java.time.DurationL Converter that returns a default value if an error occurs.
      Parameter:
      defaultValue - The default value to be returned if the value to be converted is missing or an error occurs converting the value.
    • DurationConverter

      public DurationConverter(boolean useTextFormat)
      Construct a java.time.DurationL Converter that throws a ConversionException if an error occurs.
      Parameter:
      useTextFormat - if values are in ISO8901 formats.
  • Methodendetails

    • getDefaultType

      protected Class<?> getDefaultType()
      Return the default type this Converter handles.
      Angegeben von:
      getDefaultType in Klasse org.apache.commons.beanutils.converters.AbstractConverter
      Gibt zurück:
      The default type this Converter handles.
      Seit:
      1.8.0
    • convertToType

      protected <T> T convertToType(Class<T> type, Object value) throws Throwable

      Convert a String to a java.time.Duration.

      Angegeben von:
      convertToType in Klasse org.apache.commons.beanutils.converters.AbstractConverter
      Typparameter:
      T - Target type of the conversion.
      Parameter:
      type - Data type to which this value should be converted.
      value - The input value to be converted.
      Gibt zurück:
      The converted value.
      Löst aus:
      Throwable - if an error occurs converting to the specified type