Class OpenSshConfigFile.HostEntry
java.lang.Object
org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile.HostEntry
- All Implemented Interfaces:
SshConfigStore.HostConfig
- Enclosing class:
OpenSshConfigFile
A host entry from the ssh config file. Any merging of global values and
of several matching host entries, %-substitutions, and ~ replacement have
all been done.
-
Field Summary
FieldsModifier and TypeFieldDescriptionKeys that take a whitespace-separated list of elements as argument.Keys that can be specified multiple times, building up a list. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves an unmodifiable map of all multi-valued options, with case-insensitive lookup by keys.Retrieves an unmodifiable map of all single-valued options, with case-insensitive lookup by keys.Retrieves the value of a single-valued key, or the first if the key has multiple values.Retrieves the values of a multi or list-valued key.static boolean
Does the key take a whitespace-separated list of values?(package private) void
merge
(OpenSshConfigFile.HostEntry entry) replaceTilde
(List<String> values, File home) void
Sets the value of a single-valued key if it not set yet, or adds a value to a multi-valued key.void
Sets the values of a multi- or list-valued key.(package private) void
substitute
(String originalHostName, int port, String userName, String localUserName, File home) substitute
(List<String> values, String allowed, OpenSshConfigFile.Replacer r) toString()
-
Field Details
-
MULTI_KEYS
Keys that can be specified multiple times, building up a list. (I.e., those are the keys that do not follow the general rule of "first occurrence wins".) -
LIST_KEYS
Keys that take a whitespace-separated list of elements as argument. Because the dequote-handling is different, we must handle those in the parser. There are a few other keys that take comma-separated lists as arguments, but for the parser those are single arguments that must be quoted if they contain whitespace, and taking them apart is the responsibility of the user of those keys. -
options
-
multiOptions
-
listOptions
-
-
Constructor Details
-
HostEntry
public HostEntry()
-
-
Method Details
-
getValue
Retrieves the value of a single-valued key, or the first if the key has multiple values. Keys are case-insensitive, sogetValue("HostName") == getValue("HOSTNAME")
.- Specified by:
getValue
in interfaceSshConfigStore.HostConfig
- Parameters:
key
- to get the value of- Returns:
- the value, or
null
if none
-
getValues
Retrieves the values of a multi or list-valued key. Keys are case-insensitive, sogetValue("HostName") == getValue("HOSTNAME")
.- Specified by:
getValues
in interfaceSshConfigStore.HostConfig
- Parameters:
key
- to get the values of- Returns:
- a possibly empty list of values
-
setValue
Sets the value of a single-valued key if it not set yet, or adds a value to a multi-valued key. If the value isnull
, the key is removed altogether, whether it is single-, list-, or multi-valued.- Parameters:
key
- to modifyvalue
- to set or add
-
setValue
Sets the values of a multi- or list-valued key.- Parameters:
key
- to setvalues
- a non-empty list of values
-
isListKey
Does the key take a whitespace-separated list of values?- Parameters:
key
- to check- Returns:
true
if the key is a list-valued key.
-
merge
-
substitute
-
replaceTilde
-
substitute
-
getOptions
Retrieves an unmodifiable map of all single-valued options, with case-insensitive lookup by keys.- Specified by:
getOptions
in interfaceSshConfigStore.HostConfig
- Returns:
- all single-valued options
-
getMultiValuedOptions
Retrieves an unmodifiable map of all multi-valued options, with case-insensitive lookup by keys.- Specified by:
getMultiValuedOptions
in interfaceSshConfigStore.HostConfig
- Returns:
- all multi-valued options
-
toString
-