Class OpenSshConfigFile.HostEntry
- java.lang.Object
-
- org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile.HostEntry
-
- All Implemented Interfaces:
SshConfigStore.HostConfig
- Enclosing class:
- OpenSshConfigFile
public static class OpenSshConfigFile.HostEntry extends Object implements SshConfigStore.HostConfig
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.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,List<String>>
getMultiValuedOptions()
Retrieves an unmodifiable map of all multi-valued options, with case-insensitive lookup by keys.Map<String,String>
getOptions()
Retrieves an unmodifiable map of all single-valued options, with case-insensitive lookup by keys.String
getValue(String key)
Retrieves the value of a single-valued key, or the first if the key has multiple values.List<String>
getValues(String key)
Retrieves the values of a multi or list-valued key.static boolean
isListKey(String key)
Does the key take a whitespace-separated list of values?void
setValue(String key, String value)
Sets the value of a single-valued key if it not set yet, or adds a value to a multi-valued key.void
setValue(String key, List<String> values)
Sets the values of a multi- or list-valued key.String
toString()
-
-
-
Method Detail
-
getValue
public String getValue(String key)
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
public List<String> getValues(String key)
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
public void setValue(String key, String value)
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
public void setValue(String key, List<String> values)
Sets the values of a multi- or list-valued key.- Parameters:
key
- to setvalues
- a non-empty list of values
-
isListKey
public static boolean isListKey(String key)
Does the key take a whitespace-separated list of values?- Parameters:
key
- to check- Returns:
true
if the key is a list-valued key.
-
getOptions
@NonNull public Map<String,String> 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
@NonNull public Map<String,List<String>> 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
-
-