mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 23:28:18 +00:00
Resolves checkstyle errors for remaining m (#1090)
* Reduces checkstyle errors in marker * Reduces checkstyle errors in master-worker-pattern * Reduces checkstyle errors in mediator * Reduces checkstyle errors in memento * Reduces checkstyle errors in model-view-controller * Reduces checkstyle errors in model-view-presenter * Reduces checkstyle errors in module * Reduces checkstyle errors in monad * Reduces checkstyle errors in monostate * Reduces checkstyle errors in multiton * Reduces checkstyle errors in mute-idiom * Reduces checkstyle errors in mutex
This commit is contained in:
committed by
Ilkka Seppälä
parent
3ccc9baa1a
commit
1fdc650545
@@ -30,17 +30,18 @@ import java.io.IOException;
|
||||
* A utility class that allows you to utilize mute idiom.
|
||||
*/
|
||||
public final class Mute {
|
||||
|
||||
|
||||
// The constructor is never meant to be called.
|
||||
private Mute() {}
|
||||
private Mute() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the <code>runnable</code> and throws the exception occurred within a {@link AssertionError}.
|
||||
* This method should be utilized to mute the operations that are guaranteed not to throw an exception.
|
||||
* For instance {@link ByteArrayOutputStream#write(byte[])} declares in it's signature that it can throw
|
||||
* an {@link IOException}, but in reality it cannot. This is because the bulk write method is not overridden
|
||||
* in {@link ByteArrayOutputStream}.
|
||||
*
|
||||
* Executes the <code>runnable</code> and throws the exception occurred within a {@link
|
||||
* AssertionError}. This method should be utilized to mute the operations that are guaranteed not
|
||||
* to throw an exception. For instance {@link ByteArrayOutputStream#write(byte[])} declares in
|
||||
* it's signature that it can throw an {@link IOException}, but in reality it cannot. This is
|
||||
* because the bulk write method is not overridden in {@link ByteArrayOutputStream}.
|
||||
*
|
||||
* @param runnable a runnable that should never throw an exception on execution.
|
||||
*/
|
||||
public static void mute(CheckedRunnable runnable) {
|
||||
@@ -52,11 +53,11 @@ public final class Mute {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the <code>runnable</code> and logs the exception occurred on {@link System#err}.
|
||||
* This method should be utilized to mute the operations about which most you can do is log.
|
||||
* For instance while closing a connection to database, or cleaning up a resource,
|
||||
* all you can do is log the exception occurred.
|
||||
*
|
||||
* Executes the <code>runnable</code> and logs the exception occurred on {@link System#err}. This
|
||||
* method should be utilized to mute the operations about which most you can do is log. For
|
||||
* instance while closing a connection to database, or cleaning up a resource, all you can do is
|
||||
* log the exception occurred.
|
||||
*
|
||||
* @param runnable a runnable that may throw an exception on execution.
|
||||
*/
|
||||
public static void loggedMute(CheckedRunnable runnable) {
|
||||
|
||||
Reference in New Issue
Block a user