#107 Execute Around example JavaDoc
This commit is contained in:
parent
0364b49870
commit
527da253c9
@ -7,14 +7,19 @@ 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.
|
||||
*
|
||||
* In this example, we have SimpleFileWriter class that opens and closes the file
|
||||
* <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
|
||||
* FileWriterAction implementation.
|
||||
* {@link FileWriterAction} implementation.
|
||||
*
|
||||
*/
|
||||
public class App {
|
||||
|
||||
/**
|
||||
* Program entry point
|
||||
* @param args command line args
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void main( String[] args ) throws IOException {
|
||||
|
||||
new SimpleFileWriter("testfile.txt", new FileWriterAction() {
|
||||
|
@ -6,7 +6,7 @@ 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 FileWriterAction
|
||||
* only has to specify what to do with the file resource through {@link FileWriterAction}
|
||||
* parameter.
|
||||
*
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user