Author: ruschein
Date: 2011-07-08 10:17:07 -0700 (Fri, 08 Jul 2011)
New Revision: 26119

Modified:
   
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
   
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTunableInterceptorTest.java
Log:
We're now more flexible in which annotated types we allow in tunable handlers.

Modified: 
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
===================================================================
--- 
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
       2011-07-08 14:29:26 UTC (rev 26118)
+++ 
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
       2011-07-08 17:17:07 UTC (rev 26119)
@@ -1,11 +1,13 @@
 package org.cytoscape.work;
 
+
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 /**
  * A convenience implementation of TunableHandlerFactory that will construct a 
TunableHandler
  * of the specified type given the TunableHandler in question has at least two 
constructors, one
@@ -65,7 +67,8 @@
                        return null;
        
                try {
-                       Constructor<T> con = 
tunableHandlerClass.getConstructor(Method.class, Method.class, Object.class, 
Tunable.class);
+                       Constructor<T> con =
+                               
tunableHandlerClass.getConstructor(Method.class, Method.class, Object.class, 
Tunable.class);
                        return con.newInstance(getter, setter, instance, 
tunable);
                } catch (Exception e) {
                        logger.warn("Failed to construct tunable handler. 
Missing Method based constructor for class: " + 
@@ -76,7 +79,7 @@
        
        private boolean properType(Class<?> c) {
                for ( Class<?> allowed : allowedTypes ) 
-                       if ( allowed == c )
+                       if (allowed.isAssignableFrom(c))
                                return true;
                return false;
        }

Modified: 
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTunableInterceptorTest.java
===================================================================
--- 
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTunableInterceptorTest.java
   2011-07-08 14:29:26 UTC (rev 26118)
+++ 
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTunableInterceptorTest.java
   2011-07-08 17:17:07 UTC (rev 26119)
@@ -51,7 +51,7 @@
        public void init() {
                interceptor = new ConcreteTunableInterceptor();
                interceptor.setThrowExceptions(true);
-               interceptor.addTunableHandlerFactory( new 
BasicTunableHandlerFactory(FakeTunableHandler.class,Object.class,int.class,Integer.class),null);
+               interceptor.addTunableHandlerFactory( new 
BasicTunableHandlerFactory(FakeTunableHandler.class,int.class,Integer.class),null);
                hasAnnotatedField = new HasAnnotatedField();
                hasAnnotatedSetterAndGetterMethods = new 
HasAnnotatedSetterAndGetterMethods();
                providesGUI = new ProvidesGUIExample();

-- 
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.

Reply via email to