Package org.projectnessie.model
Class ImmutableBranch
- java.lang.Object
-
- org.projectnessie.model.ImmutableBranch
-
@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.static ImmutableBranchcopyOf(Branch instance)Creates an immutable copy of aBranchvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableBranchthat have equal attribute values.StringgetHash()backend system id.ReferenceMetadatagetMetadata()Returns aReferenceMetadatainstance that contains additional metadata about this reference.StringgetName()Human-readable reference name.inthashCode()Computes a hash code from attributes:name,hash,metadata.StringtoString()Prints the immutable valueBranchwith attribute values.ImmutableBranchwithHash(String value)Copy the current immutable object by setting a value for thehashattribute.ImmutableBranchwithMetadata(ReferenceMetadata value)Copy the current immutable object by setting a value for themetadataattribute.ImmutableBranchwithName(String value)Copy the current immutable object by setting a value for thenameattribute.
-
-
-
Method Detail
-
getName
public String getName()
Human-readable reference name.
-
getHash
@Nullable public String getHash()
backend system id. Usually the 32-byte hash of the commit this reference points to.
-
getMetadata
@Nullable public ReferenceMetadata getMetadata()
Returns aReferenceMetadatainstance that contains additional metadata about this reference. Note that this is only added by the server when explicitly requested by the client.- Specified by:
getMetadatain interfaceReference- Returns:
- A
ReferenceMetadatainstance that contains additional metadata about this reference. Note that this is only added by the server when explicitly requested by the client.
-
withName
public final ImmutableBranch withName(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- Returns:
- A modified copy of the
thisobject
-
withHash
public final ImmutableBranch withHash(@Nullable String value)
Copy the current immutable object by setting a value for thehashattribute. An equals check used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for hash (can benull)- Returns:
- A modified copy of the
thisobject
-
withMetadata
public final ImmutableBranch withMetadata(@Nullable ReferenceMetadata value)
Copy the current immutable object by setting a value for themetadataattribute. A shallow reference equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for metadata (can benull)- Returns:
- A modified copy of the
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,hash,metadata.
-
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) // requiredname.hash(String | null) // nullablehash.metadata(org.projectnessie.model.ReferenceMetadata | null) // nullablemetadata.build();- Returns:
- A new ImmutableBranch builder
-
-