/** * Read the map in using a custom routine. * * @param in the input stream * @throws IOException if an error occurs while reading from the stream * @throws ClassNotFoundException if an object read from the stream can not be loaded */ private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); doReadObject(in); }
/** * Write the map out using a custom routine. * * @param out the output stream * @throws IOException if an error occurs while writing to the stream */ private void writeObject(final ObjectOutputStream out) throws IOException { out.defaultWriteObject(); doWriteObject(out); }
CaseInsensitiveMap<String, AuditLogChange> changeMap = new CaseInsensitiveMap<>(changeToMap(changesList)); CaseInsensitiveMap<String, Object> optionMap = options != null ? new CaseInsensitiveMap<>(options.toMap()) : null;
@Nonnull private CaseInsensitiveMap<String, String> generateHeaders(CaseInsensitiveMap<String, String> headers, String reason) { if (headers == null) headers = new CaseInsensitiveMap<>(); headers.put("X-Audit-Log-Reason", uriEncode(reason)); return headers; }
for (Entry<String, String> header : apiRequest.getHeaders().entrySet()) builder.addHeader(header.getKey(), header.getValue());
protected Map<String, List<String>> getHeaders(Header[] headers) { Map<String, List<String>> headersMap = new CaseInsensitiveMap<String, List<String>>(); for (Header header : headers) { String headerKey = header.getName(); String headerValue = header.getValue(); if (headersMap.containsKey(headerKey)) { final List<String> headerValues = headersMap.get(headerKey); headerValues.add(headerValue); } else { List<String> headerValues = new ArrayList<String>(); headerValues.add(headerValue); headersMap.put(headerKey, headerValues); } } return headersMap; } }
protected Map<String, List<String>> getHeaders(Header[] headers) { Map<String, List<String>> headersMap = new CaseInsensitiveMap<String, List<String>>(); for (Header header : headers) { String headerKey = header.getName(); String headerValue = header.getValue(); if (headersMap.containsKey(headerKey)) { final List<String> headerValues = headersMap.get(headerKey); headerValues.add(headerValue); } else { List<String> headerValues = new ArrayList<String>(); headerValues.add(headerValue); headersMap.put(headerKey, headerValues); } } return headersMap; } }
public FieldMap(Iterable<Field> fields) { this.fields = ImmutableList.copyOf(checkNotNull(fields)); indexMap = new CaseInsensitiveMap<String, Integer>(); // columnIndex is 1-based. int columnIndex = 1; for (Field field : this.fields) { String columnLabel = field.getName(); // If multiple columns have the same name, // prefer the earlier one as JDBC ResultSet does. if (!indexMap.containsKey(columnLabel)) { indexMap.put(columnLabel, columnIndex); } ++columnIndex; } }
public DatabaseAccountLocationsInfo(List<String> preferredLocations, URL defaultEndpoint) { this.preferredLocations = new UnmodifiableList<>(preferredLocations.stream().map(loc -> loc.toLowerCase()).collect(Collectors.toList())); this.availableWriteEndpointByLocation = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(new CaseInsensitiveMap<>()); this.availableReadEndpointByLocation = (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(new CaseInsensitiveMap<>()); this.availableReadLocations = new UnmodifiableList<>(Collections.emptyList()); this.availableWriteLocations = new UnmodifiableList<>(Collections.emptyList()); this.readEndpoints = new UnmodifiableList<>(Collections.singletonList(defaultEndpoint)); this.writeEndpoints = new UnmodifiableList<>(Collections.singletonList(defaultEndpoint)); }
public FieldMap(Iterable<Field> fields) { this.fields = ImmutableList.copyOf(checkNotNull(fields)); labelMap = new CaseInsensitiveMap<String, Integer>(); nameMap = new CaseInsensitiveMap<String, Integer>(); fullNameMap = new CaseInsensitiveMap<String, Integer>();
private UnmodifiableMap<String, URL> getEndpointByLocation(Iterable<DatabaseAccountLocation> locations, Utils.ValueHolder<UnmodifiableList<String>> orderedLocations) { Map<String, URL> endpointsByLocation = new CaseInsensitiveMap<>(); List<String> parsedLocations = new ArrayList<>(); for (DatabaseAccountLocation location: locations) { if (!Strings.isNullOrEmpty(location.getName())) { try { URL endpoint = new URL(location.getEndpoint().toLowerCase()); endpointsByLocation.put(location.getName().toLowerCase(), endpoint); parsedLocations.add(location.getName()); } catch (Exception e) { logger.warn("GetAvailableEndpointsByLocation() - skipping add for location = [{}] as it is location name is either empty or endpoint is malformed [{}]", location.getName(), location.getEndpoint()); } } } orderedLocations.v = new UnmodifiableList(parsedLocations); return (UnmodifiableMap) UnmodifiableMap.unmodifiableMap(endpointsByLocation); }