Package org.projectnessie.model
Class ImmutableReferenceMetadata.Builder
- java.lang.Object
-
- org.projectnessie.model.ImmutableReferenceMetadata.Builder
-
- Enclosing class:
- ImmutableReferenceMetadata
@NotThreadSafe public static final class ImmutableReferenceMetadata.Builder extends Object
Builds instances of typeImmutableReferenceMetadata. Initialize attributes and then invoke thebuild()method to create an immutable instance.Builderis 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 ImmutableReferenceMetadatabuild()Builds a newImmutableReferenceMetadata.ImmutableReferenceMetadata.BuildercommitMetaOfHEAD(CommitMeta commitMetaOfHEAD)Initializes the value for thecommitMetaOfHEADattribute.ImmutableReferenceMetadata.BuildercommonAncestorHash(String commonAncestorHash)Initializes the value for thecommonAncestorHashattribute.ImmutableReferenceMetadata.Builderfrom(ReferenceMetadata instance)Fill a builder with attribute values from the providedReferenceMetadatainstance.ImmutableReferenceMetadata.BuildernumCommitsAhead(Integer numCommitsAhead)Initializes the value for thenumCommitsAheadattribute.ImmutableReferenceMetadata.BuildernumCommitsBehind(Integer numCommitsBehind)Initializes the value for thenumCommitsBehindattribute.ImmutableReferenceMetadata.BuildernumTotalCommits(Long numTotalCommits)Initializes the value for thenumTotalCommitsattribute.
-
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final ImmutableReferenceMetadata.Builder from(ReferenceMetadata instance)
Fill a builder with attribute values from the providedReferenceMetadatainstance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance- The instance from which to copy values- Returns:
thisbuilder for use in a chained invocation
-
numCommitsAhead
@CanIgnoreReturnValue public final ImmutableReferenceMetadata.Builder numCommitsAhead(@Nullable Integer numCommitsAhead)
Initializes the value for thenumCommitsAheadattribute.- Parameters:
numCommitsAhead- The value for numCommitsAhead (can benull)- Returns:
thisbuilder for use in a chained invocation
-
numCommitsBehind
@CanIgnoreReturnValue public final ImmutableReferenceMetadata.Builder numCommitsBehind(@Nullable Integer numCommitsBehind)
Initializes the value for thenumCommitsBehindattribute.- Parameters:
numCommitsBehind- The value for numCommitsBehind (can benull)- Returns:
thisbuilder for use in a chained invocation
-
commitMetaOfHEAD
@CanIgnoreReturnValue public final ImmutableReferenceMetadata.Builder commitMetaOfHEAD(@Nullable CommitMeta commitMetaOfHEAD)
Initializes the value for thecommitMetaOfHEADattribute.- Parameters:
commitMetaOfHEAD- The value for commitMetaOfHEAD (can benull)- Returns:
thisbuilder for use in a chained invocation
-
commonAncestorHash
@CanIgnoreReturnValue public final ImmutableReferenceMetadata.Builder commonAncestorHash(@Nullable String commonAncestorHash)
Initializes the value for thecommonAncestorHashattribute.- Parameters:
commonAncestorHash- The value for commonAncestorHash (can benull)- Returns:
thisbuilder for use in a chained invocation
-
numTotalCommits
@CanIgnoreReturnValue public final ImmutableReferenceMetadata.Builder numTotalCommits(@Nullable Long numTotalCommits)
Initializes the value for thenumTotalCommitsattribute.- Parameters:
numTotalCommits- The value for numTotalCommits (can benull)- Returns:
thisbuilder for use in a chained invocation
-
build
public ImmutableReferenceMetadata build()
Builds a newImmutableReferenceMetadata.- Returns:
- An immutable instance of ReferenceMetadata
- Throws:
IllegalStateException- if any required attributes are missing
-
-