-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a common definition of a Scope.
- Loading branch information
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
core/src/main/java/com/github/cowwoc/pouch/core/Scope.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.github.cowwoc.pouch.core; | ||
|
||
/** | ||
* The lifespan of one or more variables. | ||
* <p> | ||
* Child scopes must call {@link #addChild(Scope)} at the end of their constructor and | ||
* {@link #removeChild(Scope)} at the end of their {@link #close()} method. | ||
*/ | ||
public interface Scope extends AutoCloseable | ||
{ | ||
/** | ||
* Adds a child scope. | ||
* | ||
* @param child the child scope | ||
* @throws IllegalStateException if the scope is closed | ||
*/ | ||
void addChild(Scope child); | ||
|
||
/** | ||
* Removes a child scope. | ||
* | ||
* @param child the child scope | ||
*/ | ||
void removeChild(Scope child); | ||
|
||
/** | ||
* @return {@code true} if the scope is closed | ||
*/ | ||
boolean isClosed(); | ||
|
||
@Override | ||
void close(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.