@Test public void testDeepObject(){ String data = "C=c;B=&&B1=b1;A=&&A1=a1;A2=a2;A3=a3&&&&"; StringReader reader = new StringReader(data); SegmentParser parser = new SegmentParser(reader); MapSegmentDeserializer deserializer = new MapSegmentDeserializer(); try(SegmentParser parser1 = parser) { Map<String,Object> map = deserializer.deserialize(parser1); assertTrue(map.containsKey("C")); assertEquals(map.get("C"),"c"); assertTrue(map.containsKey("B")); Object b = map.get("B"); assertTrue(b instanceof Map); } catch (IOException e) { e.printStackTrace(); } catch (SegmentFormatException e) { e.printStackTrace(); } }
@Override public Map<String, Object> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, Object> result = new LinkedHashMap<>(); readMap(parser,result); return result; }
MapSegmentDeserializer implements SegmentDeserializer<Map<String,Object>> { @Override public Map<String, Object> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, Object> result = new LinkedHashMap<>(); readMap(parser,result); return result; } }
MapSegmentDeserializer implements SegmentDeserializer<Map<String,Object>> { @Override public Map<String, Object> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, Object> result = new LinkedHashMap<>(); readMap(parser,result); return result; } MapSegmentDeserializer();  MapSegmentDeserializer(SegmentDeserializer<Object> valueDeserializer); }
MapSegmentDeserializer implements SegmentDeserializer<Map<String,Object>> { @Override public Map<String, Object> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, Object> result = new LinkedHashMap<>(); readMap(parser,result); return result; } MapSegmentDeserializer();  MapSegmentDeserializer(SegmentDeserializer<Object> valueDeserializer); @Override Map<String, Object> deserialize(SegmentParser parser); }
MapSegmentDeserializer implements SegmentDeserializer<Map<String,Object>> { @Override public Map<String, Object> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, Object> result = new LinkedHashMap<>(); readMap(parser,result); return result; } MapSegmentDeserializer();  MapSegmentDeserializer(SegmentDeserializer<Object> valueDeserializer); @Override Map<String, Object> deserialize(SegmentParser parser);  }