#107 Execute Around example JavaDoc

This commit is contained in:
Ilkka Seppala 2015-08-18 22:39:03 +03:00
parent 0364b49870
commit 527da253c9
2 changed files with 9 additions and 4 deletions

View File

@ -7,14 +7,19 @@ import java.io.IOException;
* The Execute Around idiom specifies some code to be executed before and after * 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 * 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. * pairs, such as resource allocation/deallocation or lock acquisition/release.
* * <p>
* In this example, we have SimpleFileWriter class that opens and closes the file * 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 * for the user. The user specifies only what to do with the file by providing the
* FileWriterAction implementation. * {@link FileWriterAction} implementation.
* *
*/ */
public class App { public class App {
/**
* Program entry point
* @param args command line args
* @throws IOException
*/
public static void main( String[] args ) throws IOException { public static void main( String[] args ) throws IOException {
new SimpleFileWriter("testfile.txt", new FileWriterAction() { new SimpleFileWriter("testfile.txt", new FileWriterAction() {

View File

@ -6,7 +6,7 @@ import java.io.IOException;
/** /**
* *
* SimpleFileWriter handles opening and closing file for the user. The user * SimpleFileWriter handles opening and closing file for the user. The user
* only has to specify what to do with the file resource through FileWriterAction * only has to specify what to do with the file resource through {@link FileWriterAction}
* parameter. * parameter.
* *
*/ */