Class GregorianCalendarConverter

java.lang.Object
org.apache.commons.beanutils.converters.AbstractConverter
dev.orne.beans.converters.GregorianCalendarConverter
All Implemented Interfaces:
org.apache.commons.beanutils.Converter

@API(status=STABLE, since="0.3") public class GregorianCalendarConverter extends org.apache.commons.beanutils.converters.AbstractConverter
Implementation of Converter that converts Calendar instances to and from String using delegating in a instance of InstantConverter.
Since:
0.3
Version:
1.0, 2020-08
Author:
(w) Iker Hernaez
  • Constructor Details

    • GregorianCalendarConverter

      public GregorianCalendarConverter()
      Creates a new instance that throws a ConversionException if an error occurs.
    • GregorianCalendarConverter

      public GregorianCalendarConverter(GregorianCalendar defaultValue)
      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
    • GregorianCalendarConverter

      public GregorianCalendarConverter(@NotNull @NotNull org.apache.commons.beanutils.Converter instantConverter)
      Creates a new instance that throws a ConversionException if an error occurs.
      Parameters:
      instantConverter - The converter to use when converting ZonedDateTime instances
    • GregorianCalendarConverter

      public GregorianCalendarConverter(@NotNull @NotNull org.apache.commons.beanutils.Converter instantConverter, GregorianCalendar defaultValue)
      Creates a new instance that returns a default value if an error occurs.
      Parameters:
      instantConverter - The converter to use when converting ZonedDateTime instances
      defaultValue - The default value to be returned if the value to be converted is missing or an error occurs converting the value
  • Method Details

    • getZonedDateTimeConverter

      @NotNull protected @NotNull org.apache.commons.beanutils.Converter getZonedDateTimeConverter()
      Returns the converter to use when converting ZonedDateTime instances.
      Returns:
      The converter to use when converting ZonedDateTime instances
    • getDefaultType

      @NotNull protected @NotNull Class<GregorianCalendar> getDefaultType()
      Specified by:
      getDefaultType in class org.apache.commons.beanutils.converters.AbstractConverter
    • convertToType

      protected <T> T convertToType(@NotNull @NotNull Class<T> type, Object value) throws Throwable
      Specified by:
      convertToType in class org.apache.commons.beanutils.converters.AbstractConverter
      Throws:
      Throwable
    • convertToString

      protected String convertToString(Object value) throws Throwable
      Overrides:
      convertToString in class org.apache.commons.beanutils.converters.AbstractConverter
      Throws:
      Throwable