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
ConstructorsConstructorDescriptionBuilder()Builder(Repository repository) Builder(RepositoryForkRequest request) Constructs a newBuilderwhich uses as its defaults all the values from the provided request. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds arequestfrom 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 theoriginof the fork.Sets the project to which theparentwill be forked.protected RepositoryForkRequest.Builderself()Overridden in concrete builder implementations to returnthis.Methods inherited from class com.atlassian.bitbucket.repository.AbstractRepositoryRequest.AbstractBuilder
description, forkable, name, publiclyAccessibleMethods inherited from class com.atlassian.bitbucket.util.BuilderSupport
addIf, addIf, addIf, addIf, addIf, addIf, checkNotBlank, requireNonBlank
-
Constructor Details
-
Builder
public Builder() -
Builder
Constructs a newBuilderwhich will use the specifiedRepositoryas the fork'sparent. The parent'snameis set as the fork's name, but the parent'sprojectis 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- theparentrepository for the new fork
-
Builder
Constructs a newBuilderwhich 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 arequestfrom the assembled values. Before the request is built, it is first verified that aparentwas specified and an exception is thrown if it was not.If no
namewas explicitly set, theparentrepository'snamewill be set as the fork's name. This ensures the constructed request honours its nullability contract.- Returns:
- the built request
- Throws:
IllegalStateException- if theparentisnull
-
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'sdefault branch.- Parameters:
value- the default branch name, ornullto use parent's default branch- Returns:
this- Since:
- 7.5
-
parent
Sets the repository to be forked, which will be theoriginof the fork.Note: This value is required. If this method is not called prior to
buildingthe request, an exception will be thrown.- Parameters:
value- the repository to fork- Returns:
this- Throws:
NullPointerException- if the providedvalueisnull
-
project
Sets the project to which theparentwill be forked.If this value is not set, or this method is not called prior to
building, the current user'spersonal projectwill be used by default.- Parameters:
value- the destination project, which may benullto use the current user's personal project- Returns:
this
-
self
Description copied from class:AbstractRepositoryRequest.AbstractBuilderOverridden in concrete builder implementations to returnthis.- Specified by:
selfin classAbstractRepositoryRequest.AbstractBuilder<RepositoryForkRequest.Builder>- Returns:
this
-