|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Classes implementing LockOneWay indicate their values may be locked.
Source code: LockOneWay.java.
After the value is locked, it may not be altered again. A value may be locked at any time, but may not be unlocked.
If you allow lcking to occur in the constructor of your LockOneWay object, remember to set any values *before* locking. Also, consider nullifying any obects no longer needed, such as "rule" objects used to validate potential sets. Since sets are no longer allowed once locked, there's no need for the rule objects anymore. Possible exception is if the rule object would be needed for cloning, unless the cloned object would also be locked.
//REQUIRED BY xbn.util.LockOneWay...START
public void lock() {
bLocked = true;
}
public boolean isLocked() {
return bLocked;
}
//REQUIRED BY xbn.util.LockOneWay...END
Method Summary | |
boolean |
isLocked()
Is the value locked? |
void |
lock()
Lock the value, forbidding further sets. |
Method Detail |
public void lock()
Lock the value, forbidding further sets. There is no way to unlock the value, so consider this function a "one way ticket".
It is recommended to crash if the value is already locked (isLocked is true). You must crash in your class' "set" functions when isLocked is true.
AssertException
- If isLocked is true.public boolean isLocked()
Is the value locked?
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.
http://sourceforge.net/projects/xbnjava