Class SystemReader.Delegate

java.lang.Object
org.eclipse.jgit.util.SystemReader
org.eclipse.jgit.util.SystemReader.Delegate
Enclosing class:
SystemReader

public static class SystemReader.Delegate extends SystemReader
Delegating SystemReader. Reduces boiler-plate code applications need to implement when overriding only a few of the SystemReader's methods.
Since:
6.9
  • Constructor Details

    • Delegate

      public Delegate(SystemReader delegate)
      Create a delegating system reader
      Parameters:
      delegate - the system reader to delegate to
  • Method Details

    • getHostname

      public String getHostname()
      Description copied from class: SystemReader
      Gets the hostname of the local host. If no hostname can be found, the hostname is set to the default value "localhost".
      Specified by:
      getHostname in class SystemReader
      Returns:
      the canonical hostname
    • getenv

      public String getenv(String variable)
      Description copied from class: SystemReader
      Get value of the system variable
      Specified by:
      getenv in class SystemReader
      Parameters:
      variable - system variable to read
      Returns:
      value of the system variable
    • getProperty

      public String getProperty(String key)
      Description copied from class: SystemReader
      Get value of the system property
      Specified by:
      getProperty in class SystemReader
      Parameters:
      key - of the system property to read
      Returns:
      value of the system property
    • openUserConfig

      public FileBasedConfig openUserConfig(Config parent, FS fs)
      Description copied from class: SystemReader
      Open the git configuration found in the user home. Use SystemReader.getUserConfig() to get the current git configuration in the user home since it manages automatic reloading when the gitconfig file was modified and avoids unnecessary reloads.
      Specified by:
      openUserConfig in class SystemReader
      Parameters:
      parent - a config with values not found directly in the returned config
      fs - the file system abstraction which will be necessary to perform certain file system operations.
      Returns:
      the git configuration found in the user home
    • openSystemConfig

      public FileBasedConfig openSystemConfig(Config parent, FS fs)
      Description copied from class: SystemReader
      Open the gitconfig configuration found in the system-wide "etc" directory. Use SystemReader.getSystemConfig() to get the current system-wide git configuration since it manages automatic reloading when the gitconfig file was modified and avoids unnecessary reloads.
      Specified by:
      openSystemConfig in class SystemReader
      Parameters:
      parent - a config with values not found directly in the returned config. Null is a reasonable value here.
      fs - the file system abstraction which will be necessary to perform certain file system operations.
      Returns:
      the gitconfig configuration found in the system-wide "etc" directory
    • openJGitConfig

      public FileBasedConfig openJGitConfig(Config parent, FS fs)
      Description copied from class: SystemReader
      Open the jgit configuration located at $XDG_CONFIG_HOME/jgit/config. Use SystemReader.getJGitConfig() to get the current jgit configuration in the user home since it manages automatic reloading when the jgit config file was modified and avoids unnecessary reloads.
      Specified by:
      openJGitConfig in class SystemReader
      Parameters:
      parent - a config with values not found directly in the returned config
      fs - the file system abstraction which will be necessary to perform certain file system operations.
      Returns:
      the jgit configuration located at $XDG_CONFIG_HOME/jgit/config
    • getCurrentTime

      public long getCurrentTime()
      Description copied from class: SystemReader
      Get the current system time
      Specified by:
      getCurrentTime in class SystemReader
      Returns:
      the current system time
    • now

      public Instant now()
      Description copied from class: SystemReader
      Get the current system time
      Overrides:
      now in class SystemReader
      Returns:
      the current system time
    • getTimezone

      public int getTimezone(long when)
      Description copied from class: SystemReader
      Get the local time zone
      Specified by:
      getTimezone in class SystemReader
      Parameters:
      when - a system timestamp
      Returns:
      the local time zone
    • getTimeZoneAt

      public ZoneOffset getTimeZoneAt(Instant when)
      Description copied from class: SystemReader
      Get the local time zone offset at "when" time
      Overrides:
      getTimeZoneAt in class SystemReader
      Parameters:
      when - a system timestamp
      Returns:
      the local time zone