Class GitURIRequirementsBuilder


  • public class GitURIRequirementsBuilder
    extends Object
    A builder to help creating requirements from GIT URIs.
    Since:
    1.2.0
    • Method Detail

      • duplicate

        @NonNull
        public GitURIRequirementsBuilder duplicate()
        Creates a new builder with the same requirements as this builder.
        Returns:
        a new builder with the same requirements as this builder.
      • fromUri

        @NonNull
        public static GitURIRequirementsBuilder fromUri​(@CheckForNull
                                                        String uri)
        Creates a new builder using the supplied URI.
        Parameters:
        uri - the URI to create the requirements of.
        Returns:
        a new builder with the requirements of the supplied URI.
      • withUri

        @NonNull
        public GitURIRequirementsBuilder withUri​(@CheckForNull
                                                 String uri)
        Replaces the requirements with those of the supplied URI.
        Parameters:
        uri - the URI.
        Returns:
        this.
      • withoutHostname

        @NonNull
        public GitURIRequirementsBuilder withoutHostname()
        Removes any hostname or hostname:port requirements.
        Returns:
        this.
      • withoutHostnamePort

        @NonNull
        public GitURIRequirementsBuilder withoutHostnamePort()
        Removes any hostname:port requirements.
        Returns:
        this.
      • withScheme

        @NonNull
        public GitURIRequirementsBuilder withScheme​(@CheckForNull
                                                    String scheme)
        Replace any scheme requirements with the supplied scheme.
        Parameters:
        scheme - the scheme to use as a requirement
        Returns:
        this.
      • withPath

        @NonNull
        public GitURIRequirementsBuilder withPath​(@CheckForNull
                                                  String path)
        Replace any path requirements with the supplied path.
        Parameters:
        path - to use as a requirement
        Returns:
        this.
      • withHostname

        @NonNull
        public GitURIRequirementsBuilder withHostname​(@CheckForNull
                                                      String hostname)
        Replace any hostname requirements with the supplied hostname.
        Parameters:
        hostname - the hostname to use as a requirement
        Returns:
        this.
      • withHostnamePort

        @NonNull
        public GitURIRequirementsBuilder withHostnamePort​(@CheckForNull
                                                          String hostname,
                                                          int port)
        Replace any hostname or hostname:port requirements with the supplied hostname and port.
        Parameters:
        hostname - the hostname to use as a requirement or (@code null} to not add any requirement
        port - the port or -1 to not add HostnamePortRequirements
        Returns:
        this.
      • build

        @NonNull
        public List<com.cloudbees.plugins.credentials.domains.DomainRequirement> build()
        Builds the list of requirements.
        Returns:
        the list of requirements.