Detect programmer error in delegate usage as early as possible and fail.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5223 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-07-10 13:19:21 +00:00
parent 5baacc36da
commit 950fb6c4aa
2 changed files with 18 additions and 0 deletions
@@ -222,6 +222,7 @@ public abstract class PlaceController extends Controller
*/
protected void addDelegate (PlaceControllerDelegate delegate)
{
ratifyDelegate(delegate);
if (_delegates == null) {
_delegates = new ArrayList<PlaceControllerDelegate>();
}
@@ -266,6 +267,14 @@ public abstract class PlaceController extends Controller
}
}
/**
* Protects against programmer error.
*/
protected void ratifyDelegate (PlaceControllerDelegate delegate)
{
// nothing to do here, all PlaceControllerDelegates are safe for us
}
/** A reference to the active client context. */
protected CrowdContext _ctx;
@@ -198,6 +198,7 @@ public class PlaceManager
*/
public void addDelegate (PlaceManagerDelegate delegate)
{
ratifyDelegate(delegate);
if (_delegates == null) {
_delegates = Lists.newArrayList();
}
@@ -675,6 +676,14 @@ public class PlaceManager
return 5 * 60 * 1000L;
}
/**
* Protects against programmer error.
*/
protected void ratifyDelegate (PlaceManagerDelegate delegate)
{
// nothing to do here, all PlaceManagerDelegates are safe for us
}
/**
* An extensible way to add to the string representation of this class. Override this (being
* sure to call super) and append your info to the buffer.