private void initServicesMetaData() { if (this.servicesMetaData != null) { return; } StartContainersResponseProtoOrBuilder p = viaProto ? proto : builder; List<StringBytesMapProto> list = p.getServicesMetaDataList(); this.servicesMetaData = new HashMap<String, ByteBuffer>(); for (StringBytesMapProto c : list) { this.servicesMetaData.put(c.getKey(), convertFromProtoFormat(c.getValue())); } }
private void addServicesMetaDataToProto() { maybeInitBuilder(); builder.clearServicesMetaData(); if (servicesMetaData == null) return; Iterable<StringBytesMapProto> iterable = new Iterable<StringBytesMapProto>() { @Override public Iterator<StringBytesMapProto> iterator() { return new Iterator<StringBytesMapProto>() { Iterator<String> keyIter = servicesMetaData.keySet().iterator(); @Override public void remove() { throw new UnsupportedOperationException(); } @Override public StringBytesMapProto next() { String key = keyIter.next(); return StringBytesMapProto.newBuilder().setKey(key) .setValue(convertToProtoFormat(servicesMetaData.get(key))) .build(); } @Override public boolean hasNext() { return keyIter.hasNext(); } }; } }; builder.addAllServicesMetaData(iterable); }
private void initServiceData() { if (this.serviceData != null) { return; } ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder; List<StringBytesMapProto> list = p.getServiceDataList(); this.serviceData = new HashMap<String, ByteBuffer>(); for (StringBytesMapProto c : list) { this.serviceData.put(c.getKey(), convertFromProtoFormat(c.getValue())); } }
private void addServiceDataToProto() { maybeInitBuilder(); builder.clearServiceData(); if (serviceData == null) return; Iterable<StringBytesMapProto> iterable = new Iterable<StringBytesMapProto>() { @Override public Iterator<StringBytesMapProto> iterator() { return new Iterator<StringBytesMapProto>() { Iterator<String> keyIter = serviceData.keySet().iterator(); @Override public void remove() { throw new UnsupportedOperationException(); } @Override public StringBytesMapProto next() { String key = keyIter.next(); return StringBytesMapProto.newBuilder().setKey(key).setValue( convertToProtoFormat(serviceData.get(key))).build(); } @Override public boolean hasNext() { return keyIter.hasNext(); } }; } }; builder.addAllServiceData(iterable); }