Skip to content

Commit 7516926

Browse files
committed
配置读取
1 parent 4381d78 commit 7516926

File tree

2 files changed

+62
-18
lines changed

2 files changed

+62
-18
lines changed
Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package info.xiaomo.server.config;
22

33

4-
import info.xiaomo.gameCore.config.AbstractConfigData;
4+
import info.xiaomo.gameCore.config.annotation.Column;
5+
import info.xiaomo.gameCore.logger.annotation.Table;
6+
import lombok.Data;
57

68
/**
79
* 把今天最好的表现当作明天最新的起点..~
@@ -17,26 +19,14 @@
1719
* desc :
1820
* Copyright(©) 2017 by xiaomo.
1921
*/
20-
public class TestConfig extends AbstractConfigData {
22+
@Data
23+
@Table(tableName = "test")
24+
public class TestConfig {
2125

26+
@Column(notNull = true)
2227
private int id;
2328

29+
@Column(name = "name")
2430
private String name;
2531

26-
27-
public int getId() {
28-
return id;
29-
}
30-
31-
public void setId(int id) {
32-
this.id = id;
33-
}
34-
35-
public String getName() {
36-
return name;
37-
}
38-
39-
public void setName(String name) {
40-
this.name = name;
41-
}
4232
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
package info.xiaomo.server.dataConfig;
2+
3+
import info.xiaomo.gameCore.config.IConfigDataManager;
4+
import info.xiaomo.gameCore.config.excel.ExcelConfigDataManager;
5+
6+
import java.util.List;
7+
8+
/**
9+
* 把今天最好的表现当作明天最新的起点..~
10+
* いま 最高の表現 として 明日最新の始発..~
11+
* Today the best performance as tomorrow newest starter!
12+
* Created by IntelliJ IDEA.
13+
* <p>
14+
* author: xiaomo
15+
* github: https://github.com/xiaomoinfo
16+
17+
* QQ : 83387856
18+
* Date : 2017/8/24 12:51
19+
* desc :
20+
* Copyright(©) 2017 by xiaomo.
21+
*/
22+
public class ConfigDataManager implements IConfigDataManager {
23+
private static ConfigDataManager ourInstance = new ConfigDataManager();
24+
private ExcelConfigDataManager manager = new ExcelConfigDataManager();
25+
26+
public static ConfigDataManager getInstance() {
27+
return ourInstance;
28+
}
29+
30+
private ConfigDataManager() {
31+
}
32+
33+
@Override
34+
public <T> T getConfig(Class<T> clz, Object... primaryKey) {
35+
return manager.getConfig(clz, primaryKey);
36+
}
37+
38+
@Override
39+
public <T> List<T> getConfigs(Class<T> clz) {
40+
return manager.getConfigs(clz);
41+
}
42+
43+
@Override
44+
public <T> T getConfigCache(Class<T> clz) {
45+
return manager.getConfigCache(clz);
46+
}
47+
48+
@Override
49+
public void init() throws Exception {
50+
manager.init();
51+
}
52+
53+
54+
}

0 commit comments

Comments
 (0)