Author: kono
Date: 2010-11-29 10:48:08 -0800 (Mon, 29 Nov 2010)
New Revision: 23035
Modified:
core3/event-api/trunk/src/main/java/org/cytoscape/event/AbstractCyEvent.java
core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEvent.java
core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEventHelper.java
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventTest.java
core3/event-api/trunk/src/test/java/org/cytoscape/event/DummyCyEventHelper.java
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyListenerAdapter.java
Log:
Generics parameters have been added to avoid IDE warnings. (Mainly for
Class<?>.)
Modified:
core3/event-api/trunk/src/main/java/org/cytoscape/event/AbstractCyEvent.java
===================================================================
---
core3/event-api/trunk/src/main/java/org/cytoscape/event/AbstractCyEvent.java
2010-11-29 18:35:33 UTC (rev 23034)
+++
core3/event-api/trunk/src/main/java/org/cytoscape/event/AbstractCyEvent.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -41,14 +41,14 @@
public abstract class AbstractCyEvent<T> implements CyEvent<T> {
private final T source;
- private final Class listenerClass;
+ private final Class<?> listenerClass;
/**
* Constructor.
* @param source The source object that fires the event. May NOT be
null.
* @param listenerClass The Class that defines the listener interface.
May NOT be null.
*/
- public AbstractCyEvent(final T source, Class listenerClass) {
+ public AbstractCyEvent(final T source, Class<?> listenerClass) {
if ( source == null )
throw new NullPointerException("event source is null");
@@ -71,7 +71,7 @@
* The Class of the listener that is expected to handle this event.
* @return The Class of the listener that is expected to handle this
event.
*/
- public Class getListenerClass() {
+ public Class<?> getListenerClass() {
return listenerClass;
}
}
Modified: core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEvent.java
===================================================================
--- core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEvent.java
2010-11-29 18:35:33 UTC (rev 23034)
+++ core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEvent.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -41,15 +41,19 @@
* relevant to that specific event.
*/
public interface CyEvent<T> {
+
/**
- * The object that fired the event.
+ * The object that fired the event.
+ *
* @return The object that fired the event.
*/
T getSource();
+
/**
- * The Class of the listener that is expected to handle this event.
+ * The Class of the listener that is expected to handle this event.
+ *
* @return The Class of the listener that is expected to handle this
event.
*/
- Class getListenerClass();
+ Class<?> getListenerClass();
}
Modified:
core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEventHelper.java
===================================================================
--- core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEventHelper.java
2010-11-29 18:35:33 UTC (rev 23034)
+++ core3/event-api/trunk/src/main/java/org/cytoscape/event/CyEventHelper.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -41,7 +41,7 @@
* @param <E> The type of event fired.
* @param event The event to be fired.
*/
- public <E extends CyEvent> void fireSynchronousEvent(final E event);
+ public <E extends CyEvent<?>> void fireSynchronousEvent(final E event);
/**
* Calls each listener found in the Service Registry identified by the
listenerClass
@@ -51,7 +51,7 @@
* @param <E> The type of event fired.
* @param event The event to be fired.
*/
- public <E extends CyEvent> void fireAsynchronousEvent(final E event);
+ public <E extends CyEvent<?>> void fireAsynchronousEvent(final E event);
/**
* Returns a single instance of CyMicroListener that will in turn
execute any method
Modified:
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
===================================================================
---
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
2010-11-29 18:35:33 UTC (rev 23034)
+++
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventHelperTest.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -36,16 +36,9 @@
package org.cytoscape.event;
-import junit.framework.Assert;
-import junit.framework.Test;
import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import java.lang.RuntimeException;
-import java.util.List;
-
-
/**
*/
public abstract class AbstractCyEventHelperTest extends TestCase {
Modified:
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventTest.java
===================================================================
---
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventTest.java
2010-11-29 18:35:33 UTC (rev 23034)
+++
core3/event-api/trunk/src/test/java/org/cytoscape/event/AbstractCyEventTest.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -36,22 +36,15 @@
package org.cytoscape.event;
-import junit.framework.Assert;
-import junit.framework.Test;
import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import java.lang.RuntimeException;
-import java.util.List;
-
-
/**
*/
public class AbstractCyEventTest extends TestCase {
private static class TestEvent<T> extends AbstractCyEvent<T> {
- TestEvent(T src, Class c) {
+ TestEvent(T src, Class<?> c) {
super(src,c);
}
}
Modified:
core3/event-api/trunk/src/test/java/org/cytoscape/event/DummyCyEventHelper.java
===================================================================
---
core3/event-api/trunk/src/test/java/org/cytoscape/event/DummyCyEventHelper.java
2010-11-29 18:35:33 UTC (rev 23034)
+++
core3/event-api/trunk/src/test/java/org/cytoscape/event/DummyCyEventHelper.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -36,13 +36,9 @@
package org.cytoscape.event;
-import org.cytoscape.event.CyEvent;
-import org.cytoscape.event.CyEventHelper;
-import org.cytoscape.event.CyListener;
-
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Method;
import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
/**
* DOCUMENT ME!
@@ -53,11 +49,11 @@
private Object lastAsynchronousEvent;
private Object lastMicroListener;
- public <E extends CyEvent> void fireSynchronousEvent(final E event) {
+ public <E extends CyEvent<?>> void fireSynchronousEvent(final E event) {
lastSynchronousEvent = event;
}
- public <E extends CyEvent> void fireAsynchronousEvent(final E event) {
+ public <E extends CyEvent<?>> void fireAsynchronousEvent(final E event)
{
lastAsynchronousEvent = event;
}
Modified:
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
===================================================================
---
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
2010-11-29 18:35:33 UTC (rev 23034)
+++
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyEventHelperImpl.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -49,24 +49,24 @@
this.micro = micro;
}
- public <E extends CyEvent> void fireSynchronousEvent(final E event) {
+ @Override public <E extends CyEvent<?>> void fireSynchronousEvent(final
E event) {
normal.fireSynchronousEvent(event);
}
- public <E extends CyEvent> void fireAsynchronousEvent(final E event) {
+ @Override public <E extends CyEvent<?>> void
fireAsynchronousEvent(final E event) {
normal.fireAsynchronousEvent(event);
}
- public <M extends CyMicroListener> M getMicroListener(Class<M> c,
Object source) {
+ @Override public <M extends CyMicroListener> M
getMicroListener(Class<M> c, Object source) {
return micro.getMicroListener(c,source);
}
- public <M extends CyMicroListener> void addMicroListener(M m, Class<M>
c, Object source) {
+ @Override public <M extends CyMicroListener> void addMicroListener(M m,
Class<M> c, Object source) {
micro.addMicroListener(m,c,source);
}
- public <M extends CyMicroListener> void removeMicroListener(M m,
Class<M> c, Object source) {
+ @Override public <M extends CyMicroListener> void removeMicroListener(M
m, Class<M> c, Object source) {
micro.removeMicroListener(m,c,source);
}
}
Modified:
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyListenerAdapter.java
===================================================================
---
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyListenerAdapter.java
2010-11-29 18:35:33 UTC (rev 23034)
+++
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyListenerAdapter.java
2010-11-29 18:48:08 UTC (rev 23035)
@@ -76,7 +76,7 @@
* @param <E> The type of event.
* @param event The event object.
*/
- public <E extends CyEvent> void fireSynchronousEvent(final E event) {
+ public <E extends CyEvent<?>> void fireSynchronousEvent(final E event) {
final Class<?> listenerClass = event.getListenerClass();
final Object[] listeners = getListeners(listenerClass);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.