Class URIRequirementBuilder

java.lang.Object
com.cloudbees.plugins.credentials.domains.URIRequirementBuilder

public class URIRequirementBuilder extends Object
A builder to help creating requirements from URIs.
Since:
1.6
  • Method Details

    • create

      @NonNull public static URIRequirementBuilder create()
      Creates an empty builder.
      Returns:
      a new empty builder.
    • fromUri

      @NonNull public static URIRequirementBuilder 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.
    • duplicate

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

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

      @NonNull public URIRequirementBuilder withoutScheme()
      Removes any scheme requirements.
      Returns:
      this.
    • withoutPath

      @NonNull public URIRequirementBuilder withoutPath()
      Removes any path requirements.
      Returns:
      this.
      Since:
      1.12
    • withoutHostname

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

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

      @NonNull public URIRequirementBuilder 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 URIRequirementBuilder withPath(@CheckForNull String path)
      Replace any path requirements with the supplied path.
      Parameters:
      path - the path to use as a requirement
      Returns:
      this.
      Since:
      1.12
    • withHostname

      @NonNull public URIRequirementBuilder 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 URIRequirementBuilder 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<DomainRequirement> build()
      Builds the list of requirements.
      Returns:
      the list of requirements.