Package com.spotify.github.v3.git
Class ImmutableTree.Builder
- java.lang.Object
-
- com.spotify.github.v3.git.ImmutableTree.Builder
-
- Enclosing class:
- ImmutableTree
@NotThreadSafe public static final class ImmutableTree.Builder extends Object
Builds instances of typeImmutableTree
. Initialize attributes and then invoke thebuild()
method to create an immutable instance.Builder
is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableTree.Builder
addAllTree(Iterable<? extends TreeItem> elements)
Adds elements totree
list.ImmutableTree.Builder
addTree(TreeItem element)
Adds one element totree
list.ImmutableTree.Builder
addTree(TreeItem... elements)
Adds elements totree
list.ImmutableTree
build()
Builds a newImmutableTree
.ImmutableTree.Builder
from(ShaLink instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.git.ShaLink
instance.ImmutableTree.Builder
from(Tree instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.git.Tree
instance.ImmutableTree.Builder
sha(String sha)
Initializes the value for thesha
attribute.ImmutableTree.Builder
tree(Iterable<? extends TreeItem> elements)
Sets or replaces all elements fortree
list.ImmutableTree.Builder
truncated(Boolean truncated)
Initializes the value for thetruncated
attribute.ImmutableTree.Builder
url(URI url)
Initializes the value for theurl
attribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableTree.Builder from(Tree instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.git.Tree
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
from
@CanIgnoreReturnValue public final ImmutableTree.Builder from(ShaLink instance)
Fill a builder with attribute values from the providedcom.spotify.github.v3.git.ShaLink
instance.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
sha
@CanIgnoreReturnValue public final ImmutableTree.Builder sha(@Nullable String sha)
Initializes the value for thesha
attribute.- Parameters:
sha
- The value for sha (can benull
)- Returns:
this
builder for use in a chained invocation
-
url
@CanIgnoreReturnValue public final ImmutableTree.Builder url(@Nullable URI url)
Initializes the value for theurl
attribute.- Parameters:
url
- The value for url (can benull
)- Returns:
this
builder for use in a chained invocation
-
addTree
@CanIgnoreReturnValue public final ImmutableTree.Builder addTree(TreeItem element)
Adds one element totree
list.- Parameters:
element
- A tree element- Returns:
this
builder for use in a chained invocation
-
addTree
@CanIgnoreReturnValue public final ImmutableTree.Builder addTree(TreeItem... elements)
Adds elements totree
list.- Parameters:
elements
- An array of tree elements- Returns:
this
builder for use in a chained invocation
-
tree
@CanIgnoreReturnValue public final ImmutableTree.Builder tree(@Nullable Iterable<? extends TreeItem> elements)
Sets or replaces all elements fortree
list.- Parameters:
elements
- An iterable of tree elements- Returns:
this
builder for use in a chained invocation
-
addAllTree
@CanIgnoreReturnValue public final ImmutableTree.Builder addAllTree(Iterable<? extends TreeItem> elements)
Adds elements totree
list.- Parameters:
elements
- An iterable of tree elements- Returns:
this
builder for use in a chained invocation
-
truncated
@CanIgnoreReturnValue public final ImmutableTree.Builder truncated(@Nullable Boolean truncated)
Initializes the value for thetruncated
attribute.- Parameters:
truncated
- The value for truncated (can benull
)- Returns:
this
builder for use in a chained invocation
-
build
public ImmutableTree build()
Builds a newImmutableTree
.- Returns:
- An immutable instance of Tree
- Throws:
IllegalStateException
- if any required attributes are missing
-
-