@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); StringMapSegmentDeserializer deserializer = new StringMapSegmentDeserializer(); try(SegmentParser parser1 = parser) { Map<String,String> map = deserializer.deserialize(parser1); assertTrue(map.containsKey("B")); assertEquals(map.get("B"),"B1=b1;A=&&A1=a1;A2=a2;A3=a3&&"); } catch (IOException e) { e.printStackTrace(); } catch (SegmentFormatException e) { e.printStackTrace(); } }
@Override public Map<String, String> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, String> result = new LinkedHashMap<>(); readMap(parser,result); return result; }
StringMapSegmentDeserializer implements SegmentDeserializer<Map<String,String>> { @Override public Map<String, String> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, String> result = new LinkedHashMap<>(); readMap(parser,result); return result; } }
StringMapSegmentDeserializer implements SegmentDeserializer<Map<String,String>> { @Override public Map<String, String> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, String> result = new LinkedHashMap<>(); readMap(parser,result); return result; } StringMapSegmentDeserializer(); }
StringMapSegmentDeserializer implements SegmentDeserializer<Map<String,String>> { @Override public Map<String, String> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, String> result = new LinkedHashMap<>(); readMap(parser,result); return result; } StringMapSegmentDeserializer(); @Override Map<String, String> deserialize(SegmentParser parser); }
StringMapSegmentDeserializer implements SegmentDeserializer<Map<String,String>> { @Override public Map<String, String> deserialize(SegmentParser parser) throws IOException, SegmentFormatException { if(parser.currentToken() == null){ parser.initToken(); } Map<String, String> result = new LinkedHashMap<>(); readMap(parser,result); return result; } StringMapSegmentDeserializer(); @Override Map<String, String> deserialize(SegmentParser parser);  }