More type safety goodness.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1844 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2006-05-12 01:27:36 +00:00
parent 93196c5045
commit 9e898c84a3
3 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -252,7 +252,7 @@ public class Table<T>
/** /**
* Returns a field mask that can be configured and used to update subsets * Returns a field mask that can be configured and used to update subsets
* of entire objects via calls to {@link #update(T,FieldMask)}. * of entire objects via calls to {@link #update(Connection,T,FieldMask)}.
*/ */
public FieldMask getFieldMask () public FieldMask getFieldMask ()
{ {
@@ -11,19 +11,19 @@ import com.samskivert.util.ResultListener;
* Dispatches a {@link ResultListener}'s callbacks on the AWT thread * Dispatches a {@link ResultListener}'s callbacks on the AWT thread
* regardless of what thread on which they were originally dispatched. * regardless of what thread on which they were originally dispatched.
*/ */
public class AWTResultListener implements ResultListener public class AWTResultListener<T> implements ResultListener<T>
{ {
/** /**
* Creates an AWT result listener that will dispatch results to the * Creates an AWT result listener that will dispatch results to the
* supplied target. * supplied target.
*/ */
public AWTResultListener (ResultListener target) public AWTResultListener (ResultListener<T> target)
{ {
_target = target; _target = target;
} }
// documentation inherited from interface // documentation inherited from interface
public void requestCompleted (final Object result) public void requestCompleted (final T result)
{ {
EventQueue.invokeLater(new Runnable() { EventQueue.invokeLater(new Runnable() {
public void run () { public void run () {
@@ -43,5 +43,5 @@ public class AWTResultListener implements ResultListener
} }
/** The result listener for which we are proxying. */ /** The result listener for which we are proxying. */
protected ResultListener _target; protected ResultListener<T> _target;
} }
@@ -175,6 +175,7 @@ public class ObserverList<T> extends ArrayList<T>
* list in a manner conforming to the notification ordering policy * list in a manner conforming to the notification ordering policy
* specified at construct time. * specified at construct time.
*/ */
@SuppressWarnings("unchecked")
public void apply (ObserverOp<T> obop) public void apply (ObserverOp<T> obop)
{ {
if (_policy == SAFE_IN_ORDER_NOTIFY) { if (_policy == SAFE_IN_ORDER_NOTIFY) {
@@ -184,11 +185,11 @@ public class ObserverList<T> extends ArrayList<T>
// array during notification don't hose us // array during notification don't hose us
int ocount = size(); int ocount = size();
if (_snap == null || _snap.length < ocount) { if (_snap == null || _snap.length < ocount) {
_snap = new Object[ocount]; _snap = (T[])new Object[ocount];
} }
Object[] obs = toArray(_snap); Object[] obs = toArray(_snap);
for (int ii = 0; ii < ocount; ii++) { for (int ii = 0; ii < ocount; ii++) {
if (!checkedApply(obop, (T)_snap[ii])) { if (!checkedApply(obop, _snap[ii])) {
remove(_snap[ii]); remove(_snap[ii]);
} }
} }
@@ -231,7 +232,7 @@ public class ObserverList<T> extends ArrayList<T>
/** Used to avoid creating a new snapshot array every time we notify /** Used to avoid creating a new snapshot array every time we notify
* our observers if the size has not changed. */ * our observers if the size has not changed. */
protected Object[] _snap; protected T[] _snap;
/** Message reported for unsupported <code>add()</code> variants. */ /** Message reported for unsupported <code>add()</code> variants. */
protected static final String UNSUPPORTED_ADD_MESSAGE = protected static final String UNSUPPORTED_ADD_MESSAGE =