1 /*
2 * Copyright (C) 2018, Thomas Wolf <thomas.wolf@paranor.ch> and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10 package org.eclipse.jgit.internal.transport.sshd;
11
12 import java.util.Collections;
13 import java.util.List;
14 import java.util.Map;
15
16 import org.apache.sshd.client.config.hosts.HostConfigEntry;
17 import org.eclipse.jgit.annotations.NonNull;
18
19 /**
20 * A {@link HostConfigEntry} that provides access to the multi-valued keys as
21 * lists of strings. The super class treats them as single strings containing
22 * comma-separated lists.
23 */
24 public class JGitHostConfigEntry extends HostConfigEntry {
25
26 private Map<String, List<String>> multiValuedOptions;
27
28 /**
29 * Sets the multi-valued options.
30 *
31 * @param options
32 * to set, may be {@code null} to set an empty map
33 */
34 public void setMultiValuedOptions(Map<String, List<String>> options) {
35 multiValuedOptions = options;
36 }
37
38 /**
39 * Retrieves all multi-valued options.
40 *
41 * @return an unmodifiable map
42 */
43 @NonNull
44 public Map<String, List<String>> getMultiValuedOptions() {
45 Map<String, List<String>> options = multiValuedOptions;
46 if (options == null) {
47 return Collections.emptyMap();
48 }
49 return Collections.unmodifiableMap(options);
50 }
51
52 }