de.caff.generics.handler

## Class CarelessLoopItemHandler<T,E extends java.lang.Exception,L extends FragileLoopItemHandler<T,E>>

- java.lang.Object
- - de.caff.generics.handler.CarelessLoopItemHandler<T,E,L>

- Type Parameters:
    `T` - item type
    `E` - exception type
    `L` - careful loop item handler
  All Implemented Interfaces:
    LoopHandler, LoopItemHandler<T>

      public class CarelessLoopItemHandler<T,E extends java.lang.Exception,L extends FragileLoopItemHandler<T,E>>
      extends java.lang.Object
      implements LoopItemHandler<T>

  Wrapper allowing to use a `FragileLoopItemHandler` as a standard `LoopItemHandler`.

  For getting such a handler it's recommended to use `Types.toLoopItemHandler(de.caff.generics.FragileLoopItemHandler)`.

  The wrapper will end the loop (i,e, return `false` from `LoopItemHandler.handle(Object)` if an exception was thrown.

  Author:
    Rammi

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CarelessLoopItemHandler(L wrapped)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterFinish()` Called after the loop has finished.
    `void` | `beforeStart()` Called before the loop is started.
    `E` | `getException()` Get the exception thrown during the last loop.
    `L` | `getWrapped()` Get the wrapped careful loop item handler.
    `boolean` | `handle(T item)` Handle an item.

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

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

- - ### Constructor Detail

    - #### CarelessLoopItemHandler

          public CarelessLoopItemHandler(@NotNull
                                         L wrapped)

      Constructor.
      Parameters:
        `wrapped` - wrapped careless handler

  - ### Method Detail

    - #### handle

          public boolean handle(T item)

      Handle an item.
      Specified by:
        `handle` in interface `LoopItemHandler<T>`
      Parameters:
        `item` - item to handle
      Returns:
        `true` go on with loop
        `false` break loop

    - #### beforeStart

          public void beforeStart()

      Called before the loop is started.
      Specified by:
        `beforeStart` in interface `LoopHandler`

    - #### afterFinish

          public void afterFinish()

      Called after the loop has finished.
      Specified by:
        `afterFinish` in interface `LoopHandler`

    - #### getWrapped

          @NotNull
          public L getWrapped()

      Get the wrapped careful loop item handler.
      Returns:
        wrapped handler

    - #### getException

          @Nullable
          public E getException()

      Get the exception thrown during the last loop.
      Returns:
        exception or `null` if there was no exception thrown