public static class

RepositoryForkRequest.Builder

extends AbstractRepositoryRequest.AbstractBuilder<B extends AbstractBuilder<B>>
java.lang.Object
   ↳ com.atlassian.bitbucket.util.BuilderSupport
     ↳ com.atlassian.bitbucket.repository.AbstractRepositoryRequest.AbstractBuilder<B extends com.atlassian.bitbucket.repository.AbstractRepositoryRequest.AbstractBuilder<B>>
       ↳ com.atlassian.bitbucket.repository.RepositoryForkRequest.Builder

Class Overview

Constructs requests for forking repositories.

Summary

[Expand]
Inherited Fields
From class com.atlassian.bitbucket.repository.AbstractRepositoryRequest.AbstractBuilder
From class com.atlassian.bitbucket.util.BuilderSupport
Public Constructors
Builder()
Builder(Repository repository)
Constructs a new Builder which will use the specified Repository as the fork's parent.
Builder(RepositoryForkRequest request)
Constructs a new Builder which uses as its defaults all the values from the provided request.
Public Methods
@Nonnull RepositoryForkRequest build()
Builds a request from the assembled values.
@Nonnull RepositoryForkRequest.Builder name(String value)
Sets the name to be used for the request.
@Nonnull RepositoryForkRequest.Builder parent(Repository value)
Sets the repository to be forked, which will be the origin of the fork.
@Nonnull RepositoryForkRequest.Builder project(Project value)
Sets the project to which the parent will be forked.
Protected Methods
RepositoryForkRequest.Builder self()
Overridden in concrete builder implementations to return this.
[Expand]
Inherited Methods
From class com.atlassian.bitbucket.repository.AbstractRepositoryRequest.AbstractBuilder
From class com.atlassian.bitbucket.util.BuilderSupport
From class java.lang.Object

Public Constructors

public Builder ()

public Builder (Repository repository)

Constructs a new Builder which will use the specified Repository as the fork's parent. The parent's name is set as the fork's name, but the parent's project is not set as the fork's project. Since names and slugs must be unique within a project, defaulting both the name and project would produce a request guaranteed to fail unless one property or the other was changed before building.

Parameters
repository the parent repository for the new fork

public Builder (RepositoryForkRequest request)

Constructs a new Builder which uses as its defaults all the values from the provided request.

Parameters
request the request to copy into the new builder

Public Methods

@Nonnull public RepositoryForkRequest build ()

Builds a request from the assembled values. Before the request is built, it is first verified that a parent was specified and an exception is thrown if it was not.

If no name was explicitly set, the parent repository's name will be set as the fork's name. This ensures the constructed request honours its nullability contract.

Returns
  • the built request
Throws
IllegalStateException if the parent is null

@Nonnull public RepositoryForkRequest.Builder name (String value)

Sets the name to be used for the request.

If this value is null, empty or contains only whitespace, or this method is not called prior to building, the parent's name will be used by default.

Parameters
value the name for the repository, which may be blank to inherit the parent's name
Returns
  • this

@Nonnull public RepositoryForkRequest.Builder parent (Repository value)

Sets the repository to be forked, which will be the origin of the fork.

Note: This value is required. If this method is not called prior to building the request, an exception will be thrown.

Parameters
value the repository to fork
Returns
  • this
Throws
NullPointerException if the provided value is null

@Nonnull public RepositoryForkRequest.Builder project (Project value)

Sets the project to which the parent will be forked.

If this value is not set, or this method is not called prior to building, the current user's personal project will be used by default.

Parameters
value the destination project, which may be null to use the current user's personal project
Returns
  • this

Protected Methods

protected RepositoryForkRequest.Builder self ()

Overridden in concrete builder implementations to return this.

Returns
  • this