Package com.norconex.commons.lang.convert

# Class AbstractConverter

java.lang.Object
com.norconex.commons.lang.convert.AbstractConverter

All Implemented Interfaces:
  `Converter`

Direct Known Subclasses:
  `BooleanConverter`, `CharacterConverter`, `CharsetConverter`, `ClassConverter`, `ContentTypeConverter`, `DateConverter`, `DimensionConverter`, `DurationConverter`, `EnumConverter`, `FileConverter`, `InstantConverter`, `LocalDateTimeConverter`, `LocaleConverter`, `NumberConverter`, `PathConverter`, `PatternConverter`, `StringConverter`, `UrlConverter`, `ZonedDateTimeConverter`, `ZoneIdConverter`

public abstract class AbstractConverter extends Object implements Converter

Adds default behaviors common to most converters, including checking for `null` values and wrapping exceptions in `ConverterException`.

Since:
  2.0.0
See Also:
  - `ConverterException`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractConverter()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `canEqual(Object other)`
  `boolean`
  `equals(Object o)`
  `int`
  `hashCode()`
  `protected abstract String`
  `nullSafeToString(Object object)`
  `protected abstract <T> T`
  `nullSafeToType(String value, Class<T> type)`
  `String`
  `toString()`
  `final String`
  `toString(Object object)`
  `protected ConverterException`
  `toStringException(Object object)`
  `protected ConverterException`
  `toStringException(Object object, Throwable e)`
  `final <T> T`
  `toType(String value, @NonNull Class<T> type)`
  `protected ConverterException`
  `toTypeException(String value, Class<?> type)`
  `protected ConverterException`
  `toTypeException(String value, Class<?> type, Throwable e)`
  `protected ConverterException`
  `toUnsupportedTypeException(Object obj)`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.norconex.commons.lang.convert.Converter

  `toString, toType`

- ## Constructor Details

  - ### AbstractConverter

    public AbstractConverter()

- ## Method Details

  - ### toType

    public final <T> T toType(String value, @NonNull @NonNull Class<T> type)
    Specified by:
      `toType` in interface `Converter`

  - ### toString

    public final String toString(Object object)
    Specified by:
      `toString` in interface `Converter`

  - ### nullSafeToType

    protected abstract <T> T nullSafeToType(String value, Class<T> type) throws Exception
    Throws:
      `Exception`

  - ### nullSafeToString

    protected abstract String nullSafeToString(Object object) throws Exception
    Throws:
      `Exception`

  - ### toUnsupportedTypeException

    protected ConverterException toUnsupportedTypeException(Object obj)

  - ### toTypeException

    protected ConverterException toTypeException(String value, Class<?> type)

  - ### toTypeException

    protected ConverterException toTypeException(String value, Class<?> type, Throwable e)

  - ### toStringException

    protected ConverterException toStringException(Object object)

  - ### toStringException

    protected ConverterException toStringException(Object object, Throwable e)

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### canEqual

    protected boolean canEqual(Object other)

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`