|
20 | 20 | package ch.powerunit.extensions.exceptions; |
21 | 21 |
|
22 | 22 | import static ch.powerunit.extensions.exceptions.Constants.verifySupplier; |
| 23 | +import static ch.powerunit.extensions.exceptions.ExceptionMapper.forException; |
| 24 | +import static ch.powerunit.extensions.exceptions.ExceptionMapper.forExceptions; |
23 | 25 | import static ch.powerunit.extensions.exceptions.Constants.verifyPredicate; |
24 | 26 | import static ch.powerunit.extensions.exceptions.Constants.verifyFunction; |
25 | 27 | import static ch.powerunit.extensions.exceptions.Constants.verifyConsumer; |
|
38 | 40 | * <p> |
39 | 41 | * <b>This class is only available if commons-collections4 is available</b> |
40 | 42 | * <p> |
41 | | - * The mapping between the interface from <i>commons-collections4</i> and this library is the following : |
| 43 | + * The mapping between the interface from <i>commons-collections4</i> and this |
| 44 | + * library is the following : |
42 | 45 | * |
43 | 46 | * <table border="1" summary="Mapping between interfaces"> |
44 | | - * <tr><th>commons-collections4</th><th>powerunit-extensions-exceptions</th></tr> |
45 | | - * <tr><td>Predicate</td><td>PredicateWithException</td></tr> |
46 | | - * <tr><td>Factory</td><td>SupplierWithException</td></tr> |
47 | | - * <tr><td>Transformer</td><td>FunctionWithException</td></tr> |
48 | | - * <tr><td>Closure</td><td>ConsumerWithException</td></tr> |
| 47 | + * <tr> |
| 48 | + * <th>commons-collections4</th> |
| 49 | + * <th>powerunit-extensions-exceptions</th> |
| 50 | + * </tr> |
| 51 | + * <tr> |
| 52 | + * <td>Predicate</td> |
| 53 | + * <td>PredicateWithException</td> |
| 54 | + * </tr> |
| 55 | + * <tr> |
| 56 | + * <td>Factory</td> |
| 57 | + * <td>SupplierWithException</td> |
| 58 | + * </tr> |
| 59 | + * <tr> |
| 60 | + * <td>Transformer</td> |
| 61 | + * <td>FunctionWithException</td> |
| 62 | + * </tr> |
| 63 | + * <tr> |
| 64 | + * <td>Closure</td> |
| 65 | + * <td>ConsumerWithException</td> |
| 66 | + * </tr> |
49 | 67 | * </table> |
50 | 68 | * |
51 | 69 | * @since 2.2.0 |
52 | 70 | * |
53 | 71 | */ |
54 | 72 | public final class CommonsCollections4Helper { |
55 | 73 |
|
56 | | - private static final Function<Exception, RuntimeException> DEFAULT_EXCEPTION_MAPPER = ExceptionMapper.forExceptions( |
57 | | - ExceptionMapper.forException(ClassCastException.class, e -> e), |
58 | | - ExceptionMapper.forException(IllegalArgumentException.class, e -> e), |
59 | | - ExceptionMapper.forException(Exception.class, FunctorException::new)); |
| 74 | + private static final Function<Exception, RuntimeException> DEFAULT_EXCEPTION_MAPPER = forExceptions( |
| 75 | + forException(ClassCastException.class, e -> e), forException(IllegalArgumentException.class, e -> e), |
| 76 | + forException(Exception.class, FunctorException::new)); |
60 | 77 |
|
61 | 78 | private CommonsCollections4Helper() { |
62 | 79 | } |
|
0 commit comments