public class MapAdapter extends XmlAdapter<MapElement[], Map<String, String>> { public MapElement[] marshal(Map<String, String> arg0) throws Exception { MapElement[] mapElements = new MapElement[arg0.size()]; int i = 0; for (Map.Entry<String, String> entry : arg0.entrySet()) mapElements[i++] = new MapElement(entry.getKey(), entry.getValue()); return mapElements; } public Map<String, String> unmarshal(MapElement[] arg0) throws Exception { Map<String, String> r = new HashMap<String, String>(); for (MapElement mapelement : arg0) r.put(mapelement.key, mapelement.value); return r; } }
@Override public int encode(ByteBuffer b) int encodedSize = size(); if(isElementOfArray()) switch(((ArrayElement)parent()).constructorType())
elt = elt.next(); if(isElementOfArray()) ArrayElement parent = (ArrayElement) parent();
@Override public long getMap() { if(_current instanceof MapElement) { return ((MapElement)_current).count(); } throw new IllegalStateException("Current value not map"); }
@Override public Map<Object, Object> getJavaMap() { if(_current instanceof MapElement) { return ((MapElement)_current).getValue(); } throw new IllegalStateException("Current value not map"); }
@Override public int encode(ByteBuffer b) int encodedSize = size(); if(isElementOfArray()) switch(((ArrayElement)parent()).constructorType())
elt = elt.next(); if(isElementOfArray()) ArrayElement parent = (ArrayElement) parent();
@Override public long getMap() { if(_current instanceof MapElement) { return ((MapElement)_current).count(); } throw new IllegalStateException("Current value not map"); }
@Override public Map<Object, Object> getJavaMap() { if(_current instanceof MapElement) { return ((MapElement)_current).getValue(); } throw new IllegalStateException("Current value not map"); }
@Override public int encode(ByteBuffer b) int encodedSize = size(); if(isElementOfArray()) switch(((ArrayElement)parent()).constructorType())
elt = elt.next(); if(isElementOfArray()) ArrayElement parent = (ArrayElement) parent();
MapElement map = new MapElement();
@Override public long getMap() { if(_current instanceof MapElement) { return ((MapElement)_current).count(); } throw new IllegalStateException("Current value not map"); }
@Override public Map<Object, Object> getJavaMap() { if(_current instanceof MapElement) { return ((MapElement)_current).getValue(); } throw new IllegalStateException("Current value not map"); }
@Override public void putMap() { putElement(new MapElement(_parent, _current)); }
@Override public void putMap() { putElement(new MapElement(_parent, _current)); }
@Override public void putMap() { putElement(new MapElement(_parent, _current)); }