Class SCMName

java.lang.Object
jenkins.scm.api.SCMName

public final class SCMName extends Object
Utility class to help with naming SCM related things.
Since:
2.2.0
  • Method Details

    • fromUrl

      @CheckForNull public static String fromUrl(@NonNull String url, @CheckForNull String... ignoredPrefixes)
      Makes best effort to guess a "sensible" display name from the hostname in the URL. For example SCMName.fromUrl("https://github.example.com", "github.") should return "example".
      Parameters:
      url - the URL.
      ignoredPrefixes - the prefixes that should be ignored.
      Returns:
      the display name or null
    • fromUrl

      @CheckForNull public static String fromUrl(@NonNull String url, @CheckForNull List<String> ignoredPrefixes)
      Makes best effort to guess a "sensible" display name from the hostname in the URL. For example SCMName.fromUrl("https://github.example.com", Arrays.asList("github.")) should return "example".
      Parameters:
      url - the URL.
      ignoredPrefixes - the prefixes that should be ignored.
      Returns:
      the display name or null