Package org.projectnessie.model
Class ImmutableHash
- java.lang.Object
-
- org.projectnessie.model.Hash
-
- org.projectnessie.model.ImmutableHash
-
@ParametersAreNonnullByDefault @Generated("org.immutables.processor.ProxyProcessor") @Immutable @CheckReturnValue public final class ImmutableHash extends Hash
Immutable implementation ofHash.Use the builder to create immutable instances:
ImmutableHash.builder().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImmutableHash.BuilderBuilds instances of typeImmutableHash.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ImmutableHash.Builderbuilder()Creates a builder forImmutableHash.static ImmutableHashcopyOf(Hash instance)Creates an immutable copy of aHashvalue.booleanequals(Object another)This instance is equal to all instances ofImmutableHashthat have equal attribute values.StringgetHash()backend system id.StringgetName()Human readable reference name.inthashCode()Returns a precomputed-on-construction hash code from attributes:name,hash.StringtoString()Prints the immutable valueHashwith attribute values.ImmutableHashwithName(String value)Copy the current immutable object by setting a value for thenameattribute.
-
-
-
Method Detail
-
getName
public String getName()
Human readable reference name.
-
getHash
public String getHash()
Description copied from interface:Referencebackend system id. Usually the 32-byte hash of the commit this reference points to.
-
withName
public final ImmutableHash 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
-
equals
public boolean equals(@Nullable Object another)
This instance is equal to all instances ofImmutableHashthat have equal attribute values.
-
hashCode
public int hashCode()
Returns a precomputed-on-construction hash code from attributes:name,hash.
-
toString
public String toString()
Prints the immutable valueHashwith attribute values.
-
copyOf
public static ImmutableHash copyOf(Hash instance)
Creates an immutable copy of aHashvalue. 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 Hash instance
-
builder
public static ImmutableHash.Builder builder()
Creates a builder forImmutableHash.ImmutableHash.builder() .name(String) // requiredname.build();- Returns:
- A new ImmutableHash builder
-
-