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 classImmutableBranch.BuilderBuilds instances of typeImmutableBranch.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableBranch.Builderbuilder()Creates a builder forImmutableBranch.ShaLinkcommit()Commit details branch is labelingstatic ImmutableBranchcopyOf(Branch instance)Creates an immutable copy of aBranchvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableBranchthat have equal attribute values.inthashCode()Computes a hash code from attributes:name,commit,isProtected,protectionUrl,protection.Optional<Boolean>isProtected()True if branch is protectedStringname()Branch nameOptional<Protection>protection()Optional<URI>protectionUrl()Branch protection API URLStringtoString()Prints the immutable valueBranchwith attribute values.ImmutableBranchwithCommit(ShaLink value)Copy the current immutable object by setting a value for thecommitattribute.ImmutableBranchwithIsProtected(boolean value)Copy the current immutable object by setting a present value for the optionalisProtectedattribute.ImmutableBranchwithIsProtected(Optional<Boolean> optional)Copy the current immutable object by setting an optional value for theisProtectedattribute.ImmutableBranchwithName(String value)Copy the current immutable object by setting a value for thenameattribute.ImmutableBranchwithProtection(Protection value)Copy the current immutable object by setting a present value for the optionalprotectionattribute.ImmutableBranchwithProtection(Optional<? extends Protection> optional)Copy the current immutable object by setting an optional value for theprotectionattribute.ImmutableBranchwithProtectionUrl(URI value)Copy the current immutable object by setting a present value for the optionalprotectionUrlattribute.ImmutableBranchwithProtectionUrl(Optional<? extends URI> optional)Copy the current immutable object by setting an optional value for theprotectionUrlattribute.
-
-
-
Method Detail
-
commit
@Nullable public ShaLink commit()
Commit details branch is labeling
-
isProtected
public Optional<Boolean> isProtected()
True if branch is protected- Specified by:
isProtectedin interfaceBranch
-
protectionUrl
public Optional<URI> protectionUrl()
Branch protection API URL- Specified by:
protectionUrlin interfaceBranch
-
protection
public Optional<Protection> protection()
- Specified by:
protectionin interfaceBranch- Returns:
- The value of the
protectionattribute
-
withName
public final ImmutableBranch withName(@Nullable String value)
Copy the current immutable object by setting a value for thenameattribute. 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
thisobject
-
withCommit
public final ImmutableBranch withCommit(@Nullable ShaLink value)
Copy the current immutable object by setting a value for thecommitattribute. 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
thisobject
-
withIsProtected
public final ImmutableBranch withIsProtected(boolean value)
Copy the current immutable object by setting a present value for the optionalisProtectedattribute.- Parameters:
value- The value for isProtected- Returns:
- A modified copy of
thisobject
-
withIsProtected
public final ImmutableBranch withIsProtected(Optional<Boolean> optional)
Copy the current immutable object by setting an optional value for theisProtectedattribute. 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
thisobject
-
withProtectionUrl
public final ImmutableBranch withProtectionUrl(URI value)
Copy the current immutable object by setting a present value for the optionalprotectionUrlattribute.- Parameters:
value- The value for protectionUrl- Returns:
- A modified copy of
thisobject
-
withProtectionUrl
public final ImmutableBranch withProtectionUrl(Optional<? extends URI> optional)
Copy the current immutable object by setting an optional value for theprotectionUrlattribute. 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
thisobject
-
withProtection
public final ImmutableBranch withProtection(Protection value)
Copy the current immutable object by setting a present value for the optionalprotectionattribute.- Parameters:
value- The value for protection- Returns:
- A modified copy of
thisobject
-
withProtection
public final ImmutableBranch withProtection(Optional<? extends Protection> optional)
Copy the current immutable object by setting an optional value for theprotectionattribute. 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
thisobject
-
equals
public boolean equals(@Nullable Object another)This instance is equal to all instances ofImmutableBranchthat 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 valueBranchwith attribute values.
-
copyOf
public static ImmutableBranch copyOf(Branch instance)
Creates an immutable copy of aBranchvalue. 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) // nullablename.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
-
-