Package com.spotify.github.v3.repos
Class ImmutableBranch
- java.lang.Object
-
- com.spotify.github.v3.repos.ImmutableBranch
-
- All Implemented Interfaces:
Branch
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableBranch extends Object implements Branch
Immutable implementation ofBranch
.Use the builder to create immutable instances:
ImmutableBranch.builder()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableBranch.Builder
Builds instances of typeImmutableBranch
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableBranch.Builder
builder()
Creates a builder forImmutableBranch
.ShaLink
commit()
Commit details branch is labelingstatic ImmutableBranch
copyOf(Branch instance)
Creates an immutable copy of aBranch
value.boolean
equals(Object another)
This instance is equal to all instances ofImmutableBranch
that have equal attribute values.int
hashCode()
Computes a hash code from attributes:name
,commit
,isProtected
,protectionUrl
,protection
.Optional<Boolean>
isProtected()
True if branch is protectedString
name()
Branch nameOptional<Protection>
protection()
Optional<URI>
protectionUrl()
Branch protection API URLString
toString()
Prints the immutable valueBranch
with attribute values.ImmutableBranch
withCommit(ShaLink value)
Copy the current immutable object by setting a value for thecommit
attribute.ImmutableBranch
withIsProtected(boolean value)
Copy the current immutable object by setting a present value for the optionalisProtected
attribute.ImmutableBranch
withIsProtected(Optional<Boolean> optional)
Copy the current immutable object by setting an optional value for theisProtected
attribute.ImmutableBranch
withName(String value)
Copy the current immutable object by setting a value for thename
attribute.ImmutableBranch
withProtection(Protection value)
Copy the current immutable object by setting a present value for the optionalprotection
attribute.ImmutableBranch
withProtection(Optional<? extends Protection> optional)
Copy the current immutable object by setting an optional value for theprotection
attribute.ImmutableBranch
withProtectionUrl(URI value)
Copy the current immutable object by setting a present value for the optionalprotectionUrl
attribute.ImmutableBranch
withProtectionUrl(Optional<? extends URI> optional)
Copy the current immutable object by setting an optional value for theprotectionUrl
attribute.
-
-
-
Method Detail
-
commit
@Nullable public ShaLink commit()
Commit details branch is labeling
-
isProtected
public Optional<Boolean> isProtected()
True if branch is protected- Specified by:
isProtected
in interfaceBranch
-
protectionUrl
public Optional<URI> protectionUrl()
Branch protection API URL- Specified by:
protectionUrl
in interfaceBranch
-
protection
public Optional<Protection> protection()
- Specified by:
protection
in interfaceBranch
- Returns:
- The value of the
protection
attribute
-
withName
public final ImmutableBranch withName(@Nullable String value)
Copy the current immutable object by setting a value for thename
attribute. An equals check used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for name (can benull
)- Returns:
- A modified copy of the
this
object
-
withCommit
public final ImmutableBranch withCommit(@Nullable ShaLink value)
Copy the current immutable object by setting a value for thecommit
attribute. A shallow reference equality check is used to prevent copying of the same value by returningthis
.- Parameters:
value
- A new value for commit (can benull
)- Returns:
- A modified copy of the
this
object
-
withIsProtected
public final ImmutableBranch withIsProtected(boolean value)
Copy the current immutable object by setting a present value for the optionalisProtected
attribute.- Parameters:
value
- The value for isProtected- Returns:
- A modified copy of
this
object
-
withIsProtected
public final ImmutableBranch withIsProtected(Optional<Boolean> optional)
Copy the current immutable object by setting an optional value for theisProtected
attribute. An equality check is used on inner nullable value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for isProtected- Returns:
- A modified copy of
this
object
-
withProtectionUrl
public final ImmutableBranch withProtectionUrl(URI value)
Copy the current immutable object by setting a present value for the optionalprotectionUrl
attribute.- Parameters:
value
- The value for protectionUrl- Returns:
- A modified copy of
this
object
-
withProtectionUrl
public final ImmutableBranch withProtectionUrl(Optional<? extends URI> optional)
Copy the current immutable object by setting an optional value for theprotectionUrl
attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for protectionUrl- Returns:
- A modified copy of
this
object
-
withProtection
public final ImmutableBranch withProtection(Protection value)
Copy the current immutable object by setting a present value for the optionalprotection
attribute.- Parameters:
value
- The value for protection- Returns:
- A modified copy of
this
object
-
withProtection
public final ImmutableBranch withProtection(Optional<? extends Protection> optional)
Copy the current immutable object by setting an optional value for theprotection
attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returningthis
.- Parameters:
optional
- A value for protection- Returns:
- A modified copy of
this
object
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableBranch
that have equal attribute values.
-
hashCode
public int hashCode()
Computes a hash code from attributes:name
,commit
,isProtected
,protectionUrl
,protection
.
-
toString
public String toString()
Prints the immutable valueBranch
with attribute values.
-
copyOf
public static ImmutableBranch copyOf(Branch instance)
Creates an immutable copy of aBranch
value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.- Parameters:
instance
- The instance to copy- Returns:
- A copied immutable Branch instance
-
builder
public static ImmutableBranch.Builder builder()
Creates a builder forImmutableBranch
.ImmutableBranch.builder() .name(String | null) // nullable
name
.commit(com.spotify.github.v3.git.ShaLink | null) // nullablecommit
.isProtected(Boolean) // optionalisProtected
.protectionUrl(java.net.URI) // optionalprotectionUrl
.protection(com.spotify.github.v3.repos.Protection) // optionalprotection
.build();- Returns:
- A new ImmutableBranch builder
-
-