public static class RepositoryForkRequest.Builder extends AbstractRepositoryRequest.AbstractBuilder<RepositoryForkRequest.Builder>
requests
for forking repositories.forkable, name, publiclyAccessible
NOT_BLANK
Constructor and Description |
---|
Builder() |
Builder(Repository repository)
|
Builder(RepositoryForkRequest request)
Constructs a new
Builder which uses as its defaults all the values from the provided request. |
Modifier and Type | Method and Description |
---|---|
RepositoryForkRequest |
build()
Builds a
request from the assembled values. |
RepositoryForkRequest.Builder |
name(String value)
Sets the name to be used for the request.
|
RepositoryForkRequest.Builder |
parent(Repository value)
Sets the repository to be forked, which will be the
origin of the fork. |
RepositoryForkRequest.Builder |
project(Project value)
Sets the project to which the
parent will be forked. |
protected RepositoryForkRequest.Builder |
self()
Overridden in concrete builder implementations to return
this . |
description, forkable, publiclyAccessible
addIf, addIf, addIf, addIf, addIf, addIf, checkNotBlank, requireNonBlank
public Builder()
public Builder(@Nonnull Repository repository)
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
.repository
- the parent
repository for the new forkpublic Builder(@Nonnull RepositoryForkRequest request)
Builder
which uses as its defaults all the values from the provided request.request
- the request to copy into the new builder@Nonnull public RepositoryForkRequest build()
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.
IllegalStateException
- if the parent
is null
@Nonnull public RepositoryForkRequest.Builder name(@Nullable String value)
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.
name
in class AbstractRepositoryRequest.AbstractBuilder<RepositoryForkRequest.Builder>
value
- the name for the repository, which may be blank to inherit the parent's namethis
@Nonnull public RepositoryForkRequest.Builder parent(@Nonnull Repository value)
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.
value
- the repository to forkthis
NullPointerException
- if the provided value
is null
@Nonnull public RepositoryForkRequest.Builder project(@Nullable Project value)
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.
value
- the destination project, which may be null
to use the current user's personal projectthis
protected RepositoryForkRequest.Builder self()
AbstractRepositoryRequest.AbstractBuilder
this
.self
in class AbstractRepositoryRequest.AbstractBuilder<RepositoryForkRequest.Builder>
this
Copyright © 2019 Atlassian. All rights reserved.