diff options
author | Henri Sara <hesara@vaadin.com> | 2011-11-08 18:02:55 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2011-11-08 18:02:55 +0200 |
commit | 0ab1d01c8da1f280370452fa2427708fd6de513e (patch) | |
tree | 4bf67b8a478da3b25af35c33c031c837ef2cc2e7 /tests/server-side/com/vaadin/data | |
parent | a61302616430cbbfc97cbdbb85fe294842b3409c (diff) | |
download | vaadin-framework-0ab1d01c8da1f280370452fa2427708fd6de513e.tar.gz vaadin-framework-0ab1d01c8da1f280370452fa2427708fd6de513e.zip |
Parameterize Property and Field with the value type.
The interfaces Property and Field and most of their implementations are
now parameterized with the type of their value. The method getValue()
returns the Property type but setValue() takes Object as its parameter.
No implicit conversions between value type and strings are performed in
most locations (fields).
Among others, AbstractTextField, DateField and RichTextArea not have
specific value types and do not accept arbitrary values.
Most locations requiring migration will be visible as compilation
errors, with the exception of some cases where a non-parameterized
Property or Field (or one parametrized with Object) is used.
Not yet done:
- Label
- converters
- setValue() parameterization (causes much more migration effort)
Diffstat (limited to 'tests/server-side/com/vaadin/data')
-rw-r--r-- | tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java | 8 | ||||
-rw-r--r-- | tests/server-side/com/vaadin/data/util/filter/AbstractFilterTest.java | 6 |
2 files changed, 6 insertions, 8 deletions
diff --git a/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java b/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java index a934b40dce..0ed554a1a0 100644 --- a/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java +++ b/tests/server-side/com/vaadin/data/util/ObjectPropertyTest.java @@ -4,8 +4,6 @@ import junit.framework.TestCase; import org.junit.Assert;
-import com.vaadin.data.util.ObjectProperty;
-
public class ObjectPropertyTest extends TestCase {
public static class TestSuperClass {
@@ -70,7 +68,7 @@ public class ObjectPropertyTest extends TestCase { ObjectProperty<TestSuperClass> prop = new ObjectProperty<TestSuperClass>(
super1, TestSuperClass.class);
Assert.assertEquals("super1", prop.getValue().getName());
- prop.setValue("super2");
+ prop.setValue(new TestSuperClass("super2"));
Assert.assertEquals("super1", super1.getName());
Assert.assertEquals("super2", prop.getValue().getName());
}
@@ -79,7 +77,7 @@ public class ObjectPropertyTest extends TestCase { ObjectProperty<TestSubClass> prop = new ObjectProperty<TestSubClass>(
sub1, TestSubClass.class);
Assert.assertEquals("Subclass: sub1", prop.getValue().getName());
- prop.setValue("sub2");
+ prop.setValue(new TestSubClass("sub2"));
Assert.assertEquals("Subclass: sub1", sub1.getName());
Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
}
@@ -92,7 +90,7 @@ public class ObjectPropertyTest extends TestCase { // create correct subclass based on the runtime type of the instance
// given to ObjectProperty constructor, which is a subclass of the type
// parameter
- prop.setValue("sub2");
+ prop.setValue(new TestSubClass("sub2"));
Assert.assertEquals("Subclass: sub2", prop.getValue().getName());
}
diff --git a/tests/server-side/com/vaadin/data/util/filter/AbstractFilterTest.java b/tests/server-side/com/vaadin/data/util/filter/AbstractFilterTest.java index beaa1c4e8f..c26847fb63 100644 --- a/tests/server-side/com/vaadin/data/util/filter/AbstractFilterTest.java +++ b/tests/server-side/com/vaadin/data/util/filter/AbstractFilterTest.java @@ -22,9 +22,9 @@ public abstract class AbstractFilterTest<FILTERTYPE extends Filter> extends } } - protected static class NullProperty implements Property { + protected static class NullProperty implements Property<String> { - public Object getValue() { + public String getValue() { return null; } @@ -33,7 +33,7 @@ public abstract class AbstractFilterTest<FILTERTYPE extends Filter> extends throw new ReadOnlyException(); } - public Class<?> getType() { + public Class<String> getType() { return String.class; } |