diff options
author | elmot <elmot@vaadin.com> | 2016-08-17 11:05:30 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-08-17 09:16:23 +0000 |
commit | ecde311474591931b8457f0b653aefa14350f0a6 (patch) | |
tree | b58b527445c62997fae17b62fe518e4e1c4ed872 /server | |
parent | 7373b232f945bbb83d92f5032bea78ad0e3f2c07 (diff) | |
download | vaadin-framework-ecde311474591931b8457f0b653aefa14350f0a6.tar.gz vaadin-framework-ecde311474591931b8457f0b653aefa14350f0a6.zip |
Rename InMemoryDataSource into ListDataSource
Change-Id: Ic0a8f5ced9139a0f712aac917b6a5841b8e1b0ab
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/server/data/DataSource.java | 18 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/server/data/ListDataSource.java (renamed from server/src/main/java/com/vaadin/server/data/InMemoryDataSource.java) | 14 | ||||
-rw-r--r-- | server/src/test/java/com/vaadin/server/data/datasource/ListDataSourceTest.java (renamed from server/src/test/java/com/vaadin/server/data/datasource/InMemoryDataSourceTest.java) | 6 |
3 files changed, 19 insertions, 19 deletions
diff --git a/server/src/main/java/com/vaadin/server/data/DataSource.java b/server/src/main/java/com/vaadin/server/data/DataSource.java index 4f6db29535..167ef07606 100644 --- a/server/src/main/java/com/vaadin/server/data/DataSource.java +++ b/server/src/main/java/com/vaadin/server/data/DataSource.java @@ -29,7 +29,7 @@ import java.util.stream.Stream; * @param <T> * data type * - * @see InMemoryDataSource + * @see ListDataSource * @see BackEndDataSource */ public interface DataSource<T> extends Function<Query, Stream<T>>, @@ -53,21 +53,21 @@ public interface DataSource<T> extends Function<Query, Stream<T>>, int size(Query t); /** - * This method creates a new {@link InMemoryDataSource} from a given - * Collection. The InMemoryDataSource creates a protective List copy of all + * This method creates a new {@link ListDataSource} from a given + * Collection. The ListDataSource creates a protective List copy of all * the contents in the Collection. * * @param data * collection of data * @return in-memory data source */ - public static <T> InMemoryDataSource<T> create(Collection<T> data) { - return new InMemoryDataSource<>(data); + public static <T> ListDataSource<T> create(Collection<T> data) { + return new ListDataSource<>(data); } /** - * This method creates a new {@link InMemoryDataSource} from given - * objects.The InMemoryDataSource creates a protective List copy of all the + * This method creates a new {@link ListDataSource} from given + * objects.The ListDataSource creates a protective List copy of all the * contents in the array. * * @param data @@ -75,7 +75,7 @@ public interface DataSource<T> extends Function<Query, Stream<T>>, * @return in-memory data source */ @SafeVarargs - public static <T> InMemoryDataSource<T> create(T... data) { - return new InMemoryDataSource<>(Arrays.asList(data)); + public static <T> ListDataSource<T> create(T... data) { + return new ListDataSource<>(Arrays.asList(data)); } }
\ No newline at end of file diff --git a/server/src/main/java/com/vaadin/server/data/InMemoryDataSource.java b/server/src/main/java/com/vaadin/server/data/ListDataSource.java index bb75f45ffb..fe478996c3 100644 --- a/server/src/main/java/com/vaadin/server/data/InMemoryDataSource.java +++ b/server/src/main/java/com/vaadin/server/data/ListDataSource.java @@ -29,7 +29,7 @@ import java.util.stream.Stream; * @param <T> * data type */ -public class InMemoryDataSource<T> implements DataSource<T> { +public class ListDataSource<T> implements DataSource<T> { private Function<Query, Stream<T>> request; private int size; @@ -41,21 +41,21 @@ public class InMemoryDataSource<T> implements DataSource<T> { * @param collection * initial data */ - public InMemoryDataSource(Collection<T> collection) { + public ListDataSource(Collection<T> collection) { final List<T> backend = new ArrayList<>(collection); request = query -> backend.stream(); size = backend.size(); } /** - * Chaining constructor for making modified {@link InMemoryDataSource}s. + * Chaining constructor for making modified {@link ListDataSource}s. * This Constructor is used internally for making sorted and filtered * variants of a base data source with actual data. * * @param request * request for the new data source */ - protected InMemoryDataSource(Function<Query, Stream<T>> request) { + protected ListDataSource(Function<Query, Stream<T>> request) { this.request = request; } @@ -71,8 +71,8 @@ public class InMemoryDataSource<T> implements DataSource<T> { * a {@link Comparator} providing the needed sorting order * @return new data source with modified sorting */ - public InMemoryDataSource<T> sortingBy(Comparator<T> sortOrder) { - return new InMemoryDataSource<>(q -> request.apply(q) + public ListDataSource<T> sortingBy(Comparator<T> sortOrder) { + return new ListDataSource<>(q -> request.apply(q) .sorted(sortOrder)); } @@ -86,7 +86,7 @@ public class InMemoryDataSource<T> implements DataSource<T> { * the type of the Comparable sort key * @return new data source with modified sorting */ - public <U extends Comparable<? super U>> InMemoryDataSource<T> sortingBy( + public <U extends Comparable<? super U>> ListDataSource<T> sortingBy( Function<T, U> sortOrder) { return sortingBy(Comparator.comparing(sortOrder)); } diff --git a/server/src/test/java/com/vaadin/server/data/datasource/InMemoryDataSourceTest.java b/server/src/test/java/com/vaadin/server/data/datasource/ListDataSourceTest.java index 5c71b1e48f..e1d57ad959 100644 --- a/server/src/test/java/com/vaadin/server/data/datasource/InMemoryDataSourceTest.java +++ b/server/src/test/java/com/vaadin/server/data/datasource/ListDataSourceTest.java @@ -7,16 +7,16 @@ import java.util.List; import java.util.stream.Collectors; import com.vaadin.server.data.DataSource; -import com.vaadin.server.data.InMemoryDataSource; +import com.vaadin.server.data.ListDataSource; import com.vaadin.server.data.Query; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -public class InMemoryDataSourceTest { +public class ListDataSourceTest { - private InMemoryDataSource<StrBean> dataSource; + private ListDataSource<StrBean> dataSource; private List<StrBean> data; @Before |