| 1 | package com.renomad.minum.utils; | |
| 2 | ||
| 3 | /** | |
| 4 | * This class is to improve maintainability in the system. It makes | |
| 5 | * possible reviewing the queue of actions and more easily understanding | |
| 6 | * the purpose of each Callable. | |
| 7 | */ | |
| 8 | public final class RunnableWithDescription implements ThrowingRunnable { | |
| 9 | ||
| 10 | private final String description; | |
| 11 | private final ThrowingRunnable r; | |
| 12 | ||
| 13 | /** | |
| 14 | * By constructing a {@link ThrowingRunnable} here, you can | |
| 15 | * provide a description of the runnable that will be reviewable | |
| 16 | * during debugging. | |
| 17 | */ | |
| 18 | public RunnableWithDescription(ThrowingRunnable r, String description) { | |
| 19 | this.description = description; | |
| 20 | this.r = r; | |
| 21 | } | |
| 22 | ||
| 23 | @Override | |
| 24 | public String toString() { | |
| 25 |
1
1. toString : replaced return value with "" for com/renomad/minum/utils/RunnableWithDescription::toString → KILLED |
return description; |
| 26 | } | |
| 27 | ||
| 28 | @Override | |
| 29 | public void run() { | |
| 30 | try { | |
| 31 |
1
1. run : removed call to com/renomad/minum/utils/ThrowingRunnable::run → KILLED |
r.run(); |
| 32 | } catch (Exception e) { | |
| 33 | throw new UtilsException(e); | |
| 34 | } | |
| 35 | } | |
| 36 | } | |
Mutations | ||
| 25 |
1.1 |
|
| 31 |
1.1 |