Author: mes
Date: 2011-07-07 15:47:19 -0700 (Thu, 07 Jul 2011)
New Revision: 26108
Added:
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
core3/work-api/trunk/src/test/java/org/cytoscape/work/BasicTunableHandlerFactoryTest.java
Modified:
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
core3/work-api/trunk/src/main/java/org/cytoscape/work/TunableHandlerFactory.java
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTunableInterceptorTest.java
Log:
made TunableHandlerFactories services
Modified:
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
===================================================================
---
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
2011-07-07 22:44:44 UTC (rev 26107)
+++
core3/work-api/trunk/src/main/java/org/cytoscape/work/AbstractTunableInterceptor.java
2011-07-07 22:47:19 UTC (rev 26108)
@@ -32,8 +32,10 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map;
import javax.swing.JPanel;
@@ -80,10 +82,6 @@
public abstract class AbstractTunableInterceptor<TH extends TunableHandler>
implements TunableInterceptor<TH> {
private boolean throwException;
- /**
- * Factory for Handlers
- */
- protected final TunableHandlerFactory<TH> factory;
/**
* Store the Handlers
@@ -95,6 +93,11 @@
*/
protected final Map<Object, Method> guiProviderMap;
+ /**
+ * A list of TunableHandlerFactory services that have been registered.
+ */
+ protected final List<TunableHandlerFactory<TH>> tunableHandlerFactories;
+
private final static Logger logger =
LoggerFactory.getLogger(AbstractTunableInterceptor.class);
/**
@@ -104,11 +107,11 @@
* <code>CLHandlerFactory</code> to get the <code>Handlers</code>
that will create the <i>Options</i> for the <code>Tasks</code> runnable through
the CommandLine Interface,
* or <code>PropHandlerFactory</code> to get the <code>Handlers</code>
for Properties.
*/
- public AbstractTunableInterceptor(TunableHandlerFactory<TH>
tunableHandlerFactory) {
- this.throwException = false;
- this.factory = tunableHandlerFactory;
+ public AbstractTunableInterceptor() {
+ throwException = false;
handlerMap = new HashMap<Object, LinkedHashMap<String, TH>>();
guiProviderMap = new HashMap<Object, Method>();
+ tunableHandlerFactories = new
ArrayList<TunableHandlerFactory<TH>>();
}
/** Used for testing only! */
@@ -137,25 +140,16 @@
final Tunable tunable =
field.getAnnotation(Tunable.class);
// Get a Handler for this type
of Tunable and...
- TH handler =
factory.getHandler(field, obj, tunable);
+ TH handler = getHandler(field,
obj, tunable);
// ...add it to the list of
Handlers
if (handler != null)
handlerList.put(field.getName(), handler);
else
- throw new Exception("No
handler for type: "
- +
field.getType().getName());
+ logOrThrowException("No
handler for type: " + field.getType().getName(), null);
} catch (final Throwable ex) {
- final StringBuilder msg = new
StringBuilder("tunable field intercept failed for "
-
+ field.toString() + "\r\n");
- msg.append(ex.getMessage());
- msg.append("\r\n");
- for (final StackTraceElement
ste : ex.getStackTrace()) {
-
msg.append(ste.toString());
- msg.append("\r\n");
- }
-
-
logOrThrowException(msg.toString());
+ logOrThrowException("tunable
field intercept failed for "
+ + field.toString(),
ex);
}
}
}
@@ -169,49 +163,46 @@
for (final Method method : obj.getClass().getMethods())
{
// See if the method is annotated as a Tunable.
if (method.isAnnotationPresent(Tunable.class)) {
- final Tunable tunable =
method.getAnnotation(Tunable.class);
- if (method.getName().startsWith("get"))
{
- if (!isValidGetter(method))
- throw new
IllegalArgumentException(
- "Invalid getter
method specified \"" + method.getName()
- + "\", maybe
this method takes arguments or returns void?");
- final String rootName =
method.getName().substring(3);
- getMethodsMap.put(rootName,
method);
- tunableMap.put(rootName,
tunable);
+ final Tunable tunable =
method.getAnnotation(Tunable.class);
+ if (method.getName().startsWith("get"))
{
+ if (!isValidGetter(method)) {
+ throw new
IllegalArgumentException("Invalid getter method specified \"" + method.getName()
+ + "\",
maybe this method takes arguments or returns void?");
+ }
- final Class getterReturnType =
method.getReturnType();
- final Method setter =
findCompatibleSetter(obj, rootName, getterReturnType);
- if (setter == null)
- throw new
IllegalArgumentException(
- "Can't find a
setter compatible with the "
- +
method.getName() + "() getter!");
+ final String rootName =
method.getName().substring(3);
+ getMethodsMap.put(rootName,
method);
+ tunableMap.put(rootName,
tunable);
- // Get a handler for get and
set methods:
- final TH handler =
-
factory.getHandler(method, setter, obj,
-
tunableMap.get(rootName));
- if (handler == null)
- logOrThrowException(
- "Failed to
create a handler for " + setter.getName() + "()!");
- else
-
handlerList.put("getset" + rootName, handler);
- } else
- throw new
IllegalArgumentException(
- "the name of the method
has to start with \"get\" but was "
- + method.getName() +
"()!");
+ final Class getterReturnType =
method.getReturnType();
+ final Method setter =
findCompatibleSetter(obj, rootName, getterReturnType);
+ if (setter == null) {
+ throw new
IllegalArgumentException("Can't find a setter compatible with the "
+ +
method.getName() + "() getter!");
+ }
+ // Get a handler with for get
and set methods:
+ final TH handler =
getHandler(method, setter, obj, tunableMap.get(rootName));
+ if (handler == null) {
+
logOrThrowException("Failed to create a handler for " + setter.getName() +
"()!",null);
+ } else {
+
handlerList.put("getset" + rootName, handler);
+ }
+ } else {
+ throw new
IllegalArgumentException("the name of the method has to start with \"get\" but
was "
+ +
method.getName() + "()!");
+ }
+
+ // See if the method is annotated as providing
a GUI...
} else if
(method.isAnnotationPresent(ProvidesGUI.class)) {
- if
(!isJPanelOrJPanelDescendent(method.getReturnType()))
- throw new
IllegalArgumentException(
- method.getName() + "
annotated with @ProvidesGUI must return JPanel!");
- else if
(method.getParameterTypes().length != 0)
- throw new
IllegalArgumentException(
- method.getName() + "
annotated with @ProvidesGUI must take 0 arguments!");
- else {
+ if
(!isJPanelOrJPanelDescendent(method.getReturnType())) {
+ throw new
IllegalArgumentException(method.getName() + " annotated with @ProvidesGUI must
return JPanel!");
+ } else if
(method.getParameterTypes().length != 0) {
+ throw new
IllegalArgumentException(method.getName() + " annotated with @ProvidesGUI must
take 0 arguments!");
+ } else {
if (!guiProviderMap.isEmpty())
- throw new
IllegalArgumentException(
- "Classes must
have at most a single @ProvidesGUI annotated method but + "
+ throw new
IllegalArgumentException("Classes must have at most a single @ProvidesGUI
annotated method but + "
+
method.getDeclaringClass().getName() + " has more than one!");
guiProviderMap.put(obj, method);
}
@@ -285,11 +276,48 @@
return false;
}
+
+ private TH getHandler(Field field, Object instance, Tunable tunable) {
+ for ( TunableHandlerFactory<TH> thf : tunableHandlerFactories )
{
+ TH th = thf.getHandler(field, instance, tunable);
+ if ( th != null )
+ return th;
+ }
+ return null;
+ }
+
+ private TH getHandler(final Method getter, final Method setter, final
Object instance, final Tunable tunable) {
+ for ( TunableHandlerFactory<TH> thf : tunableHandlerFactories )
{
+ TH th = thf.getHandler(getter, setter, instance,
tunable);
+ if ( th != null )
+ return th;
+ }
+ return null;
+ }
+
+ /**
+ * Allows TunableHandlerFactory services to be added to the list of
factories used to process Tunables.
+ * @param thf The factory to be added.
+ * @param properties OSGi service metadata. May be null.
+ */
+ public void addTunableHandlerFactory(TunableHandlerFactory<TH> thf, Map
properties) {
+ if ( thf != null )
+ tunableHandlerFactories.add(thf);
+ }
- private final void logOrThrowException(final String msg) {
+ /**
+ * Allows TunableHandlerFactory services to be removed from the list of
factories used to process Tunables.
+ * @param thf The factory to be removed.
+ * @param properties OSGi service metadata. May be null.
+ */
+ public void removeTunableHandlerFactory(TunableHandlerFactory<TH> thf,
Map properties) {
+ tunableHandlerFactories.remove(thf);
+ }
+
+ private final void logOrThrowException(final String msg, Throwable ex) {
if (throwException)
- throw new IllegalArgumentException(msg);
+ throw new IllegalArgumentException(msg, ex);
else
- logger.warn(msg);
+ logger.warn(msg, ex);
}
}
Added:
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
===================================================================
---
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
(rev 0)
+++
core3/work-api/trunk/src/main/java/org/cytoscape/work/BasicTunableHandlerFactory.java
2011-07-07 22:47:19 UTC (rev 26108)
@@ -0,0 +1,83 @@
+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
+ * with Field, Object, Tunable parameters and the other with Method, Method,
Object, Tunable parameters.
+ * If you need additional parameters to construct your TunableHandler, then
+ * it is probably best to implement the TunableHandlerFactory interface
directly!
+ *
+ * @param <T> The type of the TunableHandler.
+ */
+public class BasicTunableHandlerFactory<T extends TunableHandler> implements
TunableHandlerFactory<T> {
+
+ private final Class<T> tunableHandlerClass;
+ private final Class<?>[] allowedTypes;
+ private final static Logger logger =
LoggerFactory.getLogger(BasicTunableHandlerFactory.class);
+
+ /**
+ * Constructor.
+ * @param tunableHandlerClass The type of the TunableHandler to be
created.
+ * @param allowedTypes The object types that the TunableHandler is
associated with.
+ * For instance, an IntegerTunableHandler might allow Integer.class and
int.class.
+ */
+ public BasicTunableHandlerFactory(Class<T> tunableHandlerClass,
Class<?>... allowedTypes) {
+ this.tunableHandlerClass = tunableHandlerClass;
+ this.allowedTypes = allowedTypes;
+ }
+
+ /**
+ * Constructor.
+ * @param tunableHandlerClass The type of the TunableHandler to be
created.
+ * @param allowedTypes The object types that the TunableHandler is
associated with.
+ * For instance, an IntegerTunableHandler might allow Integer.class and
int.class.
+
+ public BasicTunableHandlerFactory(Class<T> tunableHandlerClass,
Class<?>[] allowedTypes) {
+ this.tunableHandlerClass = tunableHandlerClass;
+ this.allowedTypes = allowedTypes;
+ }
+ */
+
+ @Override
+ public final T getHandler(final Field field, final Object instance,
final Tunable tunable) {
+ if ( !properType(field.getType()) )
+ return null;
+
+ try {
+ Constructor<T> con =
tunableHandlerClass.getConstructor(Field.class, Object.class, Tunable.class);
+ return con.newInstance(field, instance, tunable);
+ } catch (Exception e) {
+ logger.warn("Failed to construct tunable handler.
Missing Field based constructor for class: " +
+ tunableHandlerClass.getName(), e);
+ return null;
+ }
+ }
+
+ @Override
+ public final T getHandler(final Method getter, final Method setter,
final Object instance, final Tunable tunable) {
+ if ( !properType(getter.getReturnType()) )
+ return null;
+
+ try {
+ 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: " +
+ tunableHandlerClass.getName(), e);
+ return null;
+ }
+ }
+
+ private boolean properType(Class<?> c) {
+ for ( Class<?> allowed : allowedTypes )
+ if ( allowed == c )
+ return true;
+ return false;
+ }
+}
Modified:
core3/work-api/trunk/src/main/java/org/cytoscape/work/TunableHandlerFactory.java
===================================================================
---
core3/work-api/trunk/src/main/java/org/cytoscape/work/TunableHandlerFactory.java
2011-07-07 22:44:44 UTC (rev 26107)
+++
core3/work-api/trunk/src/main/java/org/cytoscape/work/TunableHandlerFactory.java
2011-07-07 22:47:19 UTC (rev 26108)
@@ -6,33 +6,42 @@
/**
- * Provides a factory to create <code>Handlers</code> depending on their type.
- * <code>Handlers</code> will be generated for Fields and Methods in the class
that contains the <code>Tunables</code>.
+ * A factory service to create a <code>TunableHandler</code> for a single type
of object,
+ * determined by the type of the field or the return value of the getter
method in the
+ * appropriate methods. Each type of object (int, float, String) generally
needs a different
+ * implementation of this interface. Each implementation is expected to be
registered
+ * as an OSGi service. TunableInterceptors register the TunableHandlerFactory
services of
+ * the appropriate type.
*
- * @param <T> <code>TunableHandler</code> that will be created by this
factory. They will contain the informations
- * provided by the <code>Tunable</code> annotations and the Object itself.
- * @author Pasteur
+ * @param <T> The specific type of <code>TunableHandler</code> that will be
created by this factory.
*/
public interface TunableHandlerFactory<T extends TunableHandler> {
/**
* This method returns a <code>TunableHandler</code> for a Field
annotated as a <code>Tunable</code>
+ * if this factory can produce an appropriate handler for this type of
field. If the factory
+ * cannot produce an appropriate handler, it will return null.
*
* @param field Field that need to have a <code>Handler</code>
* @param instance the object on which we want to read/write the
Field <code>field</code>
* @param tunable Tunable that contains all the information
concerning the user interface
- * @return T the newly constructed <code>TunableHandler</code>
+ * @return T the newly constructed <code>TunableHandler</code> or
null if this factory
+ * can't handle a field of the specified type.
*/
T getHandler(final Field field, final Object instance, final Tunable
tunable);
/**
* This method returns a <code>TunableHandler</code> for a Method
annotated as a <code>Tunable</code>
+ * if this factory can produce an appropriate handler for this type of
field. If the factory
+ * cannot produce an appropriate handler, it will return null.
*
+ * @param getter a Method that need to be annotated with
<code>@Tunable</code>
* @param setter a Method that need to be annotated with
<code>@Tunable</code>
- * @param getter a Method that need to be annotated with
<code>@Tunable</code>
* @param instance the object on which we want to invoke the
<code>setter</code> and <code>getter</code> methods
* @param tunable Tunable that contains all the information
concerning the user interface
- * @return T the newly constructed <code>TunableHandler</code>
+ * @return T the newly constructed <code>TunableHandler</code> or
null if this factory
+ * can't handle a field of the specified type.
*/
- T getHandler(final Method setter, final Method getter, final Object
instance, final Tunable tunable);
+ T getHandler(final Method getter, final Method setter, final Object
instance, final Tunable tunable);
+
}
\ No newline at end of file
Modified:
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
===================================================================
---
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
2011-07-07 22:44:44 UTC (rev 26107)
+++
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTaskManagerTest.java
2011-07-07 22:47:19 UTC (rev 26108)
@@ -50,8 +50,8 @@
}
static private class SimpleTunableInterceptor<TH extends
TunableHandler> extends AbstractTunableInterceptor {
- SimpleTunableInterceptor(TunableHandlerFactory<TH>
tunableHandlerFactory) {
- super(tunableHandlerFactory);
+ SimpleTunableInterceptor() {
+ super();
}
public boolean execUI(Object... obs) {
@@ -74,7 +74,8 @@
@Test
public void testHasTunables() {
final TunableHandlerFactory<SimpleTunableHandler>
handlerFactory= mock(TunableHandlerFactory.class);
- final TunableInterceptor interceptor = new
SimpleTunableInterceptor<SimpleTunableHandler>(handlerFactory);
+ final SimpleTunableInterceptor interceptor = new
SimpleTunableInterceptor<SimpleTunableHandler>();
+ interceptor.addTunableHandlerFactory(handlerFactory, null);
final SimpleTaskMananger taskManager = new
SimpleTaskMananger(interceptor);
assertFalse("This object has *no* Tunable annotation!",
taskManager.hasTunables(new Object()));
assertTrue("This object has an annotated field!",
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-07 22:44:44 UTC (rev 26107)
+++
core3/work-api/trunk/src/test/java/org/cytoscape/work/AbstractTunableInterceptorTest.java
2011-07-07 22:47:19 UTC (rev 26108)
@@ -29,6 +29,7 @@
import java.lang.reflect.Field;
+
import java.lang.reflect.Method;
import javax.swing.JPanel;
@@ -36,23 +37,25 @@
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.LoggerFactory;
-import static org.mockito.Mockito.*;
public class AbstractTunableInterceptorTest {
- private TunableInterceptor interceptor;
+ private AbstractTunableInterceptor interceptor;
private HasAnnotatedField hasAnnotatedField;
private HasAnnotatedSetterAndGetterMethods
hasAnnotatedSetterAndGetterMethods;
private ProvidesGUIExample providesGUI;
@Before
public void init() {
- final TunableHandlerFactory<AbstractTunableHandler>
handlerFactory = new SimpleHandlerFactory();
- interceptor = new ConcreteTunableInterceptor(handlerFactory);
+ interceptor = new ConcreteTunableInterceptor();
+ interceptor.setThrowExceptions(true);
+ interceptor.addTunableHandlerFactory( new
BasicTunableHandlerFactory(FakeTunableHandler.class,Object.class,int.class,Integer.class),null);
hasAnnotatedField = new HasAnnotatedField();
hasAnnotatedSetterAndGetterMethods = new
HasAnnotatedSetterAndGetterMethods();
providesGUI = new ProvidesGUIExample();
+
}
@Test
@@ -125,7 +128,6 @@
}
}
-
class FakeTunableHandler extends AbstractTunableHandler {
public FakeTunableHandler(Field f, Object o, Tunable t) {
super(f,o,t);
@@ -137,24 +139,18 @@
}
-class SimpleHandlerFactory implements
TunableHandlerFactory<AbstractTunableHandler> {
- public AbstractTunableHandler getHandler(final Field field, final
Object instance, final Tunable tunable) {
- if (field.getType() == Exception.class)
- return null;
- return new FakeTunableHandler(field, instance, tunable);
- }
+//class SimpleHandlerFactory implements
TunableHandlerFactory<AbstractTunableHandler> {
+// public AbstractTunableHandler getHandler(final Field field, final
Object instance, final Tunable tunable) {
+// return new FakeTunableHandler(field, instance, tunable);
+// }
+//
+// public AbstractTunableHandler getHandler(final Method setter, final
Method getter, final Object instance, final Tunable tunable) {
+// return new FakeTunableHandler(setter, getter, instance,
tunable);
+// }
+//}
- public AbstractTunableHandler getHandler(final Method setter, final
Method getter, final Object instance, final Tunable tunable) {
- return new FakeTunableHandler(setter, getter, instance,
tunable);
- }
-}
-
class ConcreteTunableInterceptor extends AbstractTunableInterceptor {
- ConcreteTunableInterceptor(final
TunableHandlerFactory<AbstractTunableHandler> handlerFactory) {
- super(handlerFactory);
- setThrowExceptions(true);
- }
public boolean validateAndWriteBackTunables(Object... objs) {
return true;
Added:
core3/work-api/trunk/src/test/java/org/cytoscape/work/BasicTunableHandlerFactoryTest.java
===================================================================
---
core3/work-api/trunk/src/test/java/org/cytoscape/work/BasicTunableHandlerFactoryTest.java
(rev 0)
+++
core3/work-api/trunk/src/test/java/org/cytoscape/work/BasicTunableHandlerFactoryTest.java
2011-07-07 22:47:19 UTC (rev 26108)
@@ -0,0 +1,138 @@
+package org.cytoscape.work;
+
+import static org.junit.Assert.*;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.junit.Test;
+
+public class BasicTunableHandlerFactoryTest {
+
+ private final Source source = new Source(5);
+
+ private Field getField() {
+ try {
+ return source.getClass().getField("value");
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private Tunable getFieldTunable() {
+ try {
+ return getField().getAnnotation(Tunable.class);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private Method getGetter() {
+ try {
+ return source.getClass().getMethod("getXValue");
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private Method getSetter() {
+ try {
+ return source.getClass().getMethod("setXValue",
int.class);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ private Tunable getMethodTunable() {
+ try {
+ return getGetter().getAnnotation(Tunable.class);
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
+ @Test
+ public void testGetHandlerField() {
+ BasicTunableHandlerFactory<TunableHandler> thf = new
BasicTunableHandlerFactory(GoodTunableHandler.class, int.class);
+ TunableHandler th = thf.getHandler(getField(), source,
getFieldTunable() );
+ assertNotNull(th);
+ }
+
+ @Test
+ public void testGetHandlerMethod() {
+ BasicTunableHandlerFactory<TunableHandler> thf = new
BasicTunableHandlerFactory(GoodTunableHandler.class, int.class);
+ TunableHandler th = thf.getHandler(getGetter(), getSetter(),
source, getMethodTunable() );
+ assertNotNull(th);
+ }
+
+ @Test
+ public void testInvalidTypesField() {
+ BasicTunableHandlerFactory<TunableHandler> thf = new
BasicTunableHandlerFactory(GoodTunableHandler.class, String.class);
+ TunableHandler th = thf.getHandler(getField(), source,
getFieldTunable() );
+ assertNull(th);
+ }
+
+ @Test
+ public void testInvalidTypesMethod() {
+ BasicTunableHandlerFactory<TunableHandler> thf = new
BasicTunableHandlerFactory(GoodTunableHandler.class, String.class);
+ TunableHandler th = thf.getHandler(getGetter(), getSetter(),
source, getMethodTunable() );
+ assertNull(th);
+ }
+
+ @Test
+ public void testNoFieldConstructor() {
+ BasicTunableHandlerFactory<TunableHandler> thf = new
BasicTunableHandlerFactory(NoFieldTunableHandler.class, int.class);
+ TunableHandler th = thf.getHandler(getField(), source,
getFieldTunable() );
+ assertNull(th);
+ }
+
+ @Test
+ public void testNoMethodConstructor() {
+ BasicTunableHandlerFactory<TunableHandler> thf = new
BasicTunableHandlerFactory(NoMethodTunableHandler.class, int.class);
+ TunableHandler th = thf.getHandler(getGetter(), getSetter(),
source, getMethodTunable() );
+ assertNull(th);
+ }
+}
+
+class GoodTunableHandler extends AbstractTunableHandler {
+ public GoodTunableHandler(Field f, Object o, Tunable t) {
+ super(f,o,t);
+ }
+ public GoodTunableHandler(Method get, Method set, Object o, Tunable t) {
+ super(get,set,o,t);
+ }
+ public void handle() {}
+}
+
+class NoFieldTunableHandler extends AbstractTunableHandler {
+
+ public NoFieldTunableHandler(Method get, Method set, Object o, Tunable
t) {
+ super(get,set,o,t);
+ }
+ public void handle() {}
+}
+
+class NoMethodTunableHandler extends AbstractTunableHandler {
+
+ public NoMethodTunableHandler(Field f, Object o, Tunable t) {
+ super(f,o,t);
+ }
+ public void handle() {}
+}
+
+class Source {
+ Source(int v) {
+ value = v;
+ }
+ @Tunable
+ public int value;
+ @Tunable
+ public int getXValue() {
+ return value;
+ }
+ public void setXValue(int v) {
+ value = v;
+ }
+}
+
--
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.