aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/JGitHostConfigEntry.java
blob: 2a8af28f5d320797dd76d2da44352a2d314f5eab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
 * Copyright (C) 2018, Thomas Wolf <thomas.wolf@paranor.ch> and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
package org.eclipse.jgit.internal.transport.sshd;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.apache.sshd.client.config.hosts.HostConfigEntry;
import org.eclipse.jgit.annotations.NonNull;

/**
 * A {@link HostConfigEntry} that provides access to the multi-valued keys as
 * lists of strings. The super class treats them as single strings containing
 * comma-separated lists.
 */
public class JGitHostConfigEntry extends HostConfigEntry {

	private Map<String, List<String>> multiValuedOptions;

	/**
	 * Sets the multi-valued options.
	 *
	 * @param options
	 *            to set, may be {@code null} to set an empty map
	 */
	public void setMultiValuedOptions(Map<String, List<String>> options) {
		multiValuedOptions = options;
	}

	/**
	 * Retrieves all multi-valued options.
	 *
	 * @return an unmodifiable map
	 */
	@NonNull
	public Map<String, List<String>> getMultiValuedOptions() {
		Map<String, List<String>> options = multiValuedOptions;
		if (options == null) {
			return Collections.emptyMap();
		}
		return Collections.unmodifiableMap(options);
	}

}