Resolves checkstyle errors for execute-around extension-objects (#1071)
* Reduces checkstyle errors in execute-around * Reduces checkstyle errors in extension-objects
This commit is contained in:
committed by
Ilkka Seppälä
parent
5ae2ce6e2e
commit
4dae1fae57
@ -29,16 +29,15 @@ import java.io.IOException;
|
||||
* The Execute Around idiom specifies some code to be executed before and after a method. Typically
|
||||
* the idiom is used when the API has methods to be executed in pairs, such as resource
|
||||
* allocation/deallocation or lock acquisition/release.
|
||||
* <p>
|
||||
* In this example, we have {@link SimpleFileWriter} class that opens and closes the file for the
|
||||
* user. The user specifies only what to do with the file by providing the {@link FileWriterAction}
|
||||
* implementation.
|
||||
*
|
||||
* <p>In this example, we have {@link SimpleFileWriter} class that opens and closes the file for
|
||||
* the user. The user specifies only what to do with the file by providing the {@link
|
||||
* FileWriterAction} implementation.
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* Program entry point.
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
|
@ -27,9 +27,7 @@ import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for specifying what to do with the file resource.
|
||||
*
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface FileWriterAction {
|
||||
|
@ -27,15 +27,13 @@ import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* SimpleFileWriter handles opening and closing file for the user. The user only has to specify what
|
||||
* to do with the file resource through {@link FileWriterAction} parameter.
|
||||
*
|
||||
*/
|
||||
public class SimpleFileWriter {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*/
|
||||
public SimpleFileWriter(String filename, FileWriterAction action) throws IOException {
|
||||
try (FileWriter writer = new FileWriter(filename)) {
|
||||
|
Reference in New Issue
Block a user