Package org.jenkinsci.plugins.gitclient
Class GitURIRequirementsBuilder
- java.lang.Object
-
- org.jenkinsci.plugins.gitclient.GitURIRequirementsBuilder
-
public class GitURIRequirementsBuilder extends Object
A builder to help creating requirements from GIT URIs.- Since:
- 1.2.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<com.cloudbees.plugins.credentials.domains.DomainRequirement>build()Builds the list of requirements.static GitURIRequirementsBuildercreate()Creates an empty builder.GitURIRequirementsBuilderduplicate()Creates a new builder with the same requirements as this builder.static GitURIRequirementsBuilderfromUri(String uri)Creates a new builder using the supplied URI.GitURIRequirementsBuilderwithHostname(String hostname)Replace any hostname requirements with the supplied hostname.GitURIRequirementsBuilderwithHostnamePort(String hostname, int port)Replace any hostname or hostname:port requirements with the supplied hostname and port.GitURIRequirementsBuilderwithoutHostname()Removes any hostname or hostname:port requirements.GitURIRequirementsBuilderwithoutHostnamePort()Removes any hostname:port requirements.GitURIRequirementsBuilderwithoutPath()Removes any path requirements.GitURIRequirementsBuilderwithoutScheme()Removes any scheme requirements.GitURIRequirementsBuilderwithPath(String path)Replace any path requirements with the supplied path.GitURIRequirementsBuilderwithScheme(String scheme)Replace any scheme requirements with the supplied scheme.GitURIRequirementsBuilderwithUri(String uri)Replaces the requirements with those of the supplied URI.
-
-
-
Method Detail
-
create
@NonNull public static GitURIRequirementsBuilder create()
Creates an empty builder.- Returns:
- a new empty builder.
-
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.
-
withoutScheme
@NonNull public GitURIRequirementsBuilder withoutScheme()
Removes any scheme requirements.- Returns:
this.
-
withoutPath
@NonNull public GitURIRequirementsBuilder withoutPath()
Removes any path requirements.- 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 requirementport- the port or-1to not addHostnamePortRequirements- Returns:
this.
-
build
@NonNull public List<com.cloudbees.plugins.credentials.domains.DomainRequirement> build()
Builds the list of requirements.- Returns:
- the list of requirements.
-
-