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.
  • Constructor Details

    • HostEntry

      public HostEntry()
      Constructor used to build the merged entry; never matches anything
    • HostEntry

      public HostEntry(List<String> patterns)
      Parameters:
      patterns - to be used in matching against host name.
  • Method Details

    • 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, so getValue("HostName") == getValue("HOSTNAME").
      Specified by:
      getValue in interface SshConfigStore.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, so getValue("HostName") == getValue("HOSTNAME").
      Specified by:
      getValues in interface SshConfigStore.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 is null, the key is removed altogether, whether it is single-, list-, or multi-valued.
      Parameters:
      key - to modify
      value - 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 set
      values - 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 interface SshConfigStore.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 interface SshConfigStore.HostConfig
      Returns:
      all multi-valued options
    • toString

      public String toString()
      Overrides:
      toString in class Object