Author: mes
Date: 2011-03-05 14:27:08 -0800 (Sat, 05 Mar 2011)
New Revision: 24317
Modified:
core3/model-api/trunk/src/main/java/org/cytoscape/model/CyRow.java
core3/model-api/trunk/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
Log:
made list type return value more specific
Modified: core3/model-api/trunk/src/main/java/org/cytoscape/model/CyRow.java
===================================================================
--- core3/model-api/trunk/src/main/java/org/cytoscape/model/CyRow.java
2011-03-05 22:15:15 UTC (rev 24316)
+++ core3/model-api/trunk/src/main/java/org/cytoscape/model/CyRow.java
2011-03-05 22:27:08 UTC (rev 24317)
@@ -54,7 +54,7 @@
* @return the value found for this row in the specified column
* Please not that this method can only be used to retrieve values that
are Lists!
*/
- <T> List<?extends T> getList(String columnName, Class<T>
listElementType);
+ <T> List<T> getList(String columnName, Class<T> listElementType);
/**
* Set the specified column for this row to the specified value.
Modified:
core3/model-api/trunk/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
===================================================================
---
core3/model-api/trunk/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
2011-03-05 22:15:15 UTC (rev 24316)
+++
core3/model-api/trunk/src/test/java/org/cytoscape/model/AbstractCyTableTest.java
2011-03-05 22:27:08 UTC (rev 24317)
@@ -768,4 +768,59 @@
public void testCreateInvalidListColumn4() {
table.createListColumn("homer", null, true);
}
+
+ @Test
+ public void testReturnTypesCompileString() {
+ List<String> ls = new ArrayList<String>();
+ ls.add("homer");
+ ls.add("marge");
+ table.createListColumn("simpson", String.class, false);
+ attrs.set("simpson",ls);
+ List<String> res = attrs.getList("simpson",String.class);
+ assertEquals(ls,res);
+ }
+
+ @Test
+ public void testReturnTypesCompileInteger() {
+ List<Integer> ls = new ArrayList<Integer>();
+ ls.add(1);
+ ls.add(2);
+ table.createListColumn("simpson", Integer.class, false);
+ attrs.set("simpson",ls);
+ List<Integer> res = attrs.getList("simpson",Integer.class);
+ assertEquals(ls,res);
+ }
+
+ @Test
+ public void testReturnTypesCompileLong() {
+ List<Long> ls = new ArrayList<Long>();
+ ls.add(1L);
+ ls.add(2L);
+ table.createListColumn("simpson", Long.class, false);
+ attrs.set("simpson",ls);
+ List<Long> res = attrs.getList("simpson",Long.class);
+ assertEquals(ls,res);
+ }
+
+ @Test
+ public void testReturnTypesCompileDouble() {
+ List<Double> ls = new ArrayList<Double>();
+ ls.add(1.0);
+ ls.add(2.0);
+ table.createListColumn("simpson", Double.class, false);
+ attrs.set("simpson",ls);
+ List<Double> res = attrs.getList("simpson",Double.class);
+ assertEquals(ls,res);
+ }
+
+ @Test
+ public void testReturnTypesCompileBoolean() {
+ List<Boolean> ls = new ArrayList<Boolean>();
+ ls.add(true);
+ ls.add(false);
+ table.createListColumn("simpson", Boolean.class, false);
+ attrs.set("simpson",ls);
+ List<Boolean> res = attrs.getList("simpson",Boolean.class);
+ assertEquals(ls,res);
+ }
}
--
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.