|
@@ -9,8 +9,6 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* Jackson util
|
|
@@ -91,30 +89,4 @@ public class JacksonUtil {
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
-
|
|
|
- /*public static <T> T readValueRefer(String jsonStr, Class<T> clazz) {
|
|
|
- try {
|
|
|
- return getInstance().readValue(jsonStr, new TypeReference<T>() { });
|
|
|
- } catch (JsonParseException e) {
|
|
|
- logger.error(e.getMessage(), e);
|
|
|
- } catch (JsonMappingException e) {
|
|
|
- logger.error(e.getMessage(), e);
|
|
|
- } catch (IOException e) {
|
|
|
- logger.error(e.getMessage(), e);
|
|
|
- }
|
|
|
- return null;
|
|
|
- }*/
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- try {
|
|
|
- Map<String, String> map = new HashMap<String, String>();
|
|
|
- map.put("aaa", "111");
|
|
|
- map.put("bbb", "222");
|
|
|
- String json = writeValueAsString(map);
|
|
|
- System.out.println(json);
|
|
|
- System.out.println(readValue(json, Map.class));
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error(e.getMessage(), e);
|
|
|
- }
|
|
|
- }
|
|
|
}
|