Class RepositoryForkRequest.Builder
java.lang.Object
com.atlassian.bitbucket.util.BuilderSupport
com.atlassian.bitbucket.repository.AbstractRepositoryRequest.AbstractBuilder<RepositoryForkRequest.Builder>
com.atlassian.bitbucket.repository.RepositoryForkRequest.Builder
- Enclosing class:
- RepositoryForkRequest
public static class RepositoryForkRequest.Builder
extends AbstractRepositoryRequest.AbstractBuilder<RepositoryForkRequest.Builder>
Constructs
requests
for forking repositories.-
Field Summary
Fields inherited from class com.atlassian.bitbucket.util.BuilderSupport
NOT_BLANK
-
Constructor Summary
ConstructorDescriptionBuilder()
Builder
(Repository repository) Builder
(RepositoryForkRequest request) Constructs a newBuilder
which uses as its defaults all the values from the provided request. -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds arequest
from the assembled values.defaultBranch
(String value) Sets the default branch name to be applied to the new fork.parent
(Repository value) Sets the repository to be forked, which will be theorigin
of the fork.Sets the project to which theparent
will be forked.protected RepositoryForkRequest.Builder
self()
Overridden in concrete builder implementations to returnthis
.Methods inherited from class com.atlassian.bitbucket.repository.AbstractRepositoryRequest.AbstractBuilder
description, forkable, name, publiclyAccessible
Methods inherited from class com.atlassian.bitbucket.util.BuilderSupport
addIf, addIf, addIf, addIf, addIf, addIf, checkNotBlank, requireNonBlank
-
Constructor Details
-
Builder
public Builder() -
Builder
Constructs a newBuilder
which will use the specifiedRepository
as the fork'sparent
. The parent'sname
is set as the fork's name, but the parent'sproject
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 beforebuilding
.- Parameters:
repository
- theparent
repository for the new fork
-
Builder
Constructs a newBuilder
which uses as its defaults all the values from the provided request.- Parameters:
request
- the request to copy into the new builder
-
-
Method Details
-
build
Builds arequest
from the assembled values. Before the request is built, it is first verified that aparent
was specified and an exception is thrown if it was not.If no
name
was explicitly set, theparent
repository'sname
will be set as the fork's name. This ensures the constructed request honours its nullability contract.- Returns:
- the built request
- Throws:
IllegalStateException
- if theparent
isnull
-
defaultBranch
Sets the default branch name to be applied to the new fork. If a default branch name is not specified, the fork will inherit itsparent's
default branch.- Parameters:
value
- the default branch name, ornull
to use parent's default branch- Returns:
this
- Since:
- 7.5
-
parent
Sets the repository to be forked, which will be theorigin
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 providedvalue
isnull
-
project
Sets the project to which theparent
will be forked.If this value is not set, or this method is not called prior to
building
, the current user'spersonal project
will be used by default.- Parameters:
value
- the destination project, which may benull
to use the current user's personal project- Returns:
this
-
self
Description copied from class:AbstractRepositoryRequest.AbstractBuilder
Overridden in concrete builder implementations to returnthis
.- Specified by:
self
in classAbstractRepositoryRequest.AbstractBuilder<RepositoryForkRequest.Builder>
- Returns:
this
-