提交 1ef434c1 编写于 作者: 昶乐

移除对fastjson的依赖

上级 8a2cd82a
......@@ -88,12 +88,7 @@
<artifactId>pmd-test</artifactId>
<version>${pmd.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.9</version>
</dependency>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -21,8 +21,9 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
/**
* @author changle.lq
......@@ -47,13 +48,17 @@ public class NameListServiceImpl implements NameListService {
@Override
public List<String> getNameList(String className, String name) {
return JSON.parseArray((String)PROPERTIES.get(className + SEPARATOR + name), String.class);
Gson gson = new Gson();
return gson.fromJson((String)PROPERTIES.get(className + SEPARATOR + name),
new TypeToken<List<String>>() {}.getType());
}
@Override
public <K, V> Map<K, V> getNameMap(String className, String name, Class<K> kClass, Class<V> vClass) {
return JSON.parseObject((String)PROPERTIES.get(className + SEPARATOR + name),
new TypeReference<Map<K, V>>(kClass, vClass) {});
Gson gson = new Gson();
return gson.fromJson((String)PROPERTIES.get(className + SEPARATOR + name),
new TypeToken<Map<K, V>>() {
}.getType());
}
private static class LinkedProperties extends Properties {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册