Java code List Map, HashMap, JSON parser snippet
package com.newegg.ec.solr.eventsalestoreservice.tuple;
import kafka.message.MessageAndMetadata;
public class DispatcherCell_inProgress extends Cell{
public DispatcherCell_inProgress(MessageAndMetadata<byte[], byte[]> mm) {
super(mm);
}
/*
static {
mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);
mapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
}
*/
/*
public HashMap<String, Object> getSingleContent() throws IOException {
Map<String, Object> map = getParseMap(this.getCELL_CONTENT());
map.forEach((k,v)->{
if(k.equalsIgnoreCase("EntityOrList")){
try {
currentContentMap = mapper.readValue(String.valueOf(v), HashMap.class);
} catch (IOException e) {
e.printStackTrace();
}
}
});
return currentContentMap;
}
public HashMap<String, Object> getParseMap(String value) throws IOException {
HashMap<String, Object> tempMap = mapper.readValue(value, HashMap.class);
return tempMap;
}
*/
/*
// List of Hashmap
public HashMap<String, Object> getSingleContent() throws IOException {
final String[] content = {""};
List<HashMap<String, Object>> lists = getParseMap(this.getCELL_CONTENT());
lists.forEach(item-> content[0] = (String) item.get("EntityOrList"));
currentContentMap = mapper.readValue(content[0], HashMap.class);
return currentContentMap ;
}
public List<HashMap<String, Object>> getParseMap(String value) throws IOException {
List<HashMap<String, Object>> List = mapper.readValue(value, List.class);
return List;
}
*/
/*
public HashMap<String, Object> getSingleContent() throws IOException {
final String[] content = {""};
List lists = getParseMap(this.getCELL_CONTENT());
lists.forEach(item-> content[0] = (String) item.get("EntityOrList"));
currentContentMap = mapper.readValue(content[0], HashMap.class);
return currentContentMap ;
}
list of list
public List<List<String>> getParseMap(String value) throws IOException {
List<List<String>> List = mapper.readValue(value, List.class);
return List;
}
*/
/*
TransactionNumber
StoreType
StoreID
ItemNumber
Description
ItemType
Priority
Status
Reserved1
StoreIDvice
CountryCode
CompanyCode
IsCombo
ActiveDate
ExpirationDate
*/
// Map of Map
// @Test
// public void getParseMap() throws IOException {
// Map<String, Map<String, Object>> currentContentMap = cell.getParseMap(cell.getCELL_CONTENT());
// currentContentMap.forEach((k,v)->System.out.println("key : " + k + " value : " + v));
// }
// List of Map
// @Test
// public void getParseMap() throws IOException {
// String msgBody = cell.getCELL_CONTENT();
// List<HashMap<String, Object>> list = cell.getParseMap(msgBody);
// list.forEach(item->log.info(item.get("Action")));
// list.forEach(item->log.info(item.get("TransactionNumber")));
// }
}
Java code List Map, HashMap, JSON parser snippet的更多相关文章
- java fastjson:Map与json以及JSONObject ,JSONObject与String互转
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson ...
- Java集合 之Map(HashMap、Hashtable 、TreeMap、WeakHashMap )理解(new)
HashMap 说明: 在详细介绍HashMap的代码之前,我们需要了解:HashMap就是一个散列表,它是通过“拉链法”解决哈希冲突的.还需要再补充说明的一点是影响HashMap性能的有两个参数:初 ...
- Java 集合框架:HashMap
原文出处:Java8 系列之重新认识 HashMap 摘要 HashMap 是 Java 程序员使用频率最高的用于映射 (键值对) 处理的数据类型.随着 JDK(Java Developmet Kit ...
- Map HashMap 排序 迭代循环 修改值
HashMap dgzhMap = Dict.getDict("dgzh"); Iterator it_d = dgzhMap.entrySet().iterator(); whi ...
- Java Code Examples for org.codehaus.jackson.map.DeserializationConfig 配置
The following code examples are extracted from open source projects. You can click to vote up the e ...
- JSONObject.fromObject(map)(JSON与JAVA数据的转换)
JSON与JAVA数据的转换(JSON 即 JavaScript Object Natation,它是一种轻量级的数据交换格式,非常适合于服务器与 JavaScript 的交互.) 上一篇文章中有这么 ...
- java bean、List、数组、map和Json的相互转化
工程 json包为 代码 package com.my.json; public class ChildBean { private String childName; private String ...
- 转载:JSONObject.fromObject(map)(JSON与JAVA数据的转换)
转载网址:http://blog.sina.com.cn/s/blog_821025b70100wh6v.html JSON与JAVA数据的转换(JSON 即 JavaScript Object Na ...
- java map转json servlet response
1.手写一个map转json的类 1.1 调用方式 //给前端放回json数据 Map<String, Object> map = new HashMap<>(); map.p ...
随机推荐
- LNOI2019 退役记
Day -4 最近这两天智商有点不在线啊..得好好调整作息了,滚粗感++ 复习模板好啊 下午睡了一觉,智商似乎回来了一丢丢,滚粗感-- Day -3 智商略有回暖,滚粗感-- 明天有模拟赛,要加油啊 ...
- 渗透实战(周二):FLUXION暴力破解WIFI登录口令
Wi-Fi攻与防 假设我们Kali Linux 攻击机有一个无线网卡,想通过特殊手段连入名称:414的Wi-Fi网络,那以下便是特殊手段的具体过程. Wi-Fi的破解 硬件:MacBook Pro.小 ...
- hdu_1036_Average is not Fast Enough_201311021335
Average is not Fast Enough! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (J ...
- Mac OSX:添加host地址
Mac OSX的hosts文件位于/private/etc/hosts.记得用sudo权限编辑即可.在文件中添加如下内容: xxx.xxx.xxx.xxx (ip地址) abc.com(你的h ...
- selenium清空默认文字
默认输入框 鼠标点击上去还有文案 直接用 clear不可以
- Codeforces Round #277 (Div. 2)A. Calculating Function 水
A. Calculating Function For a positive integer n let's define a function f: f(n) = - 1 + 2 - 3 + ...
- 20170322js面向对象
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- How to use shared model by git in sql source control of red gate
1.clone the git repository for datbase 2.open sql source control window and select the target databa ...
- Base Class Doesn't Contain Parameterless Constructor?
http://stackoverflow.com/questions/7689742/base-class-doesnt-contain-parameterless-constructor #regi ...
- mongodb 对内存的占用监控 ——mongostat,linux系统可用的内存是free + buffers + cached
刚开始使用mongodb的时候,不太注意mongodb的内存使用,但通过查资料发现mongodb对内存的占用是巨大的,在本地测试服务器中,8G的内存居然被占用了45%.汗呀. 本文就来剖析一下mong ...