blob: 29c188b82daeec3ca7b5f4c00d5874acf50cb68f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package com.vaadin.data.provider;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
class StrBean implements Serializable {
private static final String[] values = new String[] { "Foo", "Bar", "Baz" };
private String value;
private final int id;
private final int randomNumber;
public StrBean(String value, int id, int randomNumber) {
this.value = value;
this.id = id;
this.randomNumber = randomNumber;
}
public String getValue() {
return value;
}
public int getId() {
return id;
}
public int getRandomNumber() {
return randomNumber;
}
public void setValue(String value) {
this.value = value;
}
public static List<StrBean> generateRandomBeans(int max) {
List<StrBean> data = new ArrayList<>();
Random r = new Random(13337);
data.add(new StrBean("Xyz", 10, max));
for (int i = 0; i < max - 1; ++i) {
data.add(new StrBean(values[r.nextInt(values.length)], i,
r.nextInt(10)));
}
return data;
}
@Override
public String toString() {
return "{ " + value + ", " + randomNumber + ", " + id + " }";
}
}
|