de.caff.generics.converter

## Class CarelessTypeConverter<T,S>

- java.lang.Object
- - de.caff.generics.converter.CarelessTypeConverter<T,S>

- All Implemented Interfaces:
    Function1<T,S>, java.util.function.Function<S,T>

      public class CarelessTypeConverter<T,S>
      extends java.lang.Object
      implements Function1<T,S>

  A standard type converter which wraps a fragile type converter. This allows to use fragile type converters as standard type converters.
  Author:
    Rammi

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CarelessTypeConverter(FragileTypeConverter<T,S> wrapped, T defaultValue)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `apply(S object)` Convert an object to another type.
    `void` | `clear()` Clear the latest exception.
    `TypeConverterException` | `getLatestException()` Get the latest exception caught during conversion.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface de.caff.generics.function.Function1

      `after, andThen, applyNonNull, applyOrDefault, fallback, fallback, from, from, nonFragile, nonFragile, nonFragileX, partial, withFallback`

    - ### Methods inherited from interface java.util.function.Function

      `compose, identity`

- - ### Constructor Detail

    - #### CarelessTypeConverter

          public CarelessTypeConverter(@NotNull
                                       FragileTypeConverter<T,S> wrapped,
                                       @Nullable
                                       T defaultValue)

      Constructor.
      Parameters:
        `wrapped` - converter to wrap
        `defaultValue` - default value used as return value if an exception occurred

  - ### Method Detail

    - #### getLatestException

          @Nullable
          public TypeConverterException getLatestException()

      Get the latest exception caught during conversion.
      Returns:
        latest exception caught

    - #### clear

          public void clear()

      Clear the latest exception.

    - #### apply

          public T apply(S object)

      Convert an object to another type.
      Specified by:
        `apply` in interface `java.util.function.Function<S,T>`
      Parameters:
        `object` - object to convert
      Returns:
        target object