@Override protected void writeInternal(ObjectDataOutput out) throws IOException { super.writeInternal(out); out.writeInt(indexInfoList.size()); for (MapIndexInfo mapIndex : indexInfoList) { mapIndex.writeData(out); } out.writeInt(interceptorInfoList.size()); for (InterceptorInfo interceptorInfo : interceptorInfoList) { interceptorInfo.writeData(out); } }
public void addMapInterceptors(MapContainer mapContainer) { List<MapInterceptor> interceptorList = mapContainer.getInterceptors(); Map<String, MapInterceptor> interceptorMap = mapContainer.getInterceptorMap(); Map<MapInterceptor, String> revMap = new HashMap<MapInterceptor, String>(); for (Map.Entry<String, MapInterceptor> entry : interceptorMap.entrySet()) { revMap.put(entry.getValue(), entry.getKey()); } InterceptorInfo interceptorInfo = new InterceptorInfo(mapContainer.getName()); for (MapInterceptor interceptor : interceptorList) { interceptorInfo.addInterceptor(revMap.get(interceptor), interceptor); } interceptorInfoList.add(interceptorInfo); }
@Override protected void readInternal(ObjectDataInput in) throws IOException { super.readInternal(in); int size = in.readInt(); for (int i = 0; i < size; i++) { MapIndexInfo mapIndexInfo = new MapIndexInfo(); mapIndexInfo.readData(in); indexInfoList.add(mapIndexInfo); } int size2 = in.readInt(); for (int i = 0; i < size2; i++) { InterceptorInfo info = new InterceptorInfo(); info.readData(in); interceptorInfoList.add(info); } }