-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevel23.lesson04.home01
51 lines (42 loc) · 1.48 KB
/
level23.lesson04.home01
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
package com.javarush.test.level23.lesson04.home01;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/* Inner 3
Внутри класса Solution:
1) реализуйте private class TaskDataProvider используя Task и DbMock, цель которого - обновить поле tasks.
2) реализуйте private class NameDataProvider используя String и DbMock, цель которого - обновить поле names.
*/
public class Solution {
private List<Task> tasks;
private List<String> names;
private DbDataProvider taskDataProvider = new TaskDataProvider();
private DbDataProvider nameDataProvider = new NameDataProvider();
class TaskDataProvider implements DbDataProvider<Task>
{
@Override
public void refreshAllData(Map criteria)
{
tasks = DbMock.getFakeTasks(criteria);
}
}
class NameDataProvider implements DbDataProvider<String>
{
@Override
public void refreshAllData(Map criteria)
{
names = DbMock.getFakeNames(criteria);
}
}
public void refresh() {
Map taskCriteria = ViewMock.getFakeTasksCriteria();
taskDataProvider.refreshAllData(taskCriteria);
Map nameCriteria = ViewMock.getFakeNamesCriteria();
nameDataProvider.refreshAllData(nameCriteria);
}
private interface DbDataProvider<T> {
void refreshAllData(Map criteria);
}
class Task {
}
}