Class CommitBuilder


  • public class CommitBuilder
    extends java.lang.Object
    Helper to generate commits against a store.
    • Constructor Summary

      Constructors 
      Constructor Description
      CommitBuilder​(org.projectnessie.versioned.VersionStore store)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CommitBuilder add​(org.projectnessie.versioned.Operation operation)
      Adds an operation to the current commit.
      CommitBuilder delete​(java.lang.String key)
      Adds a delete operation to the current commit.
      CommitBuilder delete​(org.projectnessie.versioned.Key key)
      Adds a delete operation to the current commit.
      CommitBuilder fromLatest()
      Uses the latest remote hash as a reference to base the commit on.
      CommitBuilder fromReference​(org.projectnessie.versioned.Hash reference)
      Sets a reference to base the commit on.
      CommitBuilder put​(java.lang.String key, org.projectnessie.model.Content value)
      Adds a put operation to the current commit.
      CommitBuilder put​(java.lang.String key, org.projectnessie.model.Content value, org.projectnessie.model.Content expected)  
      CommitBuilder put​(org.projectnessie.versioned.Key key, org.projectnessie.model.Content value)
      Adds a put operation to the current commit.
      CommitBuilder put​(org.projectnessie.versioned.Key key, org.projectnessie.model.Content value, org.projectnessie.model.Content expected)  
      org.projectnessie.versioned.Hash toBranch​(org.projectnessie.versioned.BranchName branchName)
      Pushes the commit to the branch.
      CommitBuilder unchanged​(java.lang.String key)
      Adds an unchanged operation to the current commit.
      CommitBuilder unchanged​(org.projectnessie.versioned.Key key)
      Adds an unchanged operation to the current commit.
      CommitBuilder withMetadata​(org.projectnessie.model.CommitMeta metadata)
      Sets metadata for the current commit.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CommitBuilder

        public CommitBuilder​(org.projectnessie.versioned.VersionStore store)
    • Method Detail

      • put

        public CommitBuilder put​(java.lang.String key,
                                 org.projectnessie.model.Content value)
        Adds a put operation to the current commit.
        Parameters:
        key - key's name to add
        value - the value associated with the key
        Returns:
        the builder instance
      • put

        public CommitBuilder put​(java.lang.String key,
                                 org.projectnessie.model.Content value,
                                 org.projectnessie.model.Content expected)
      • put

        public CommitBuilder put​(org.projectnessie.versioned.Key key,
                                 org.projectnessie.model.Content value)
        Adds a put operation to the current commit.
        Parameters:
        key - key to add
        value - the value associated with the key
        Returns:
        the builder instance
      • put

        public CommitBuilder put​(org.projectnessie.versioned.Key key,
                                 org.projectnessie.model.Content value,
                                 org.projectnessie.model.Content expected)
      • delete

        public CommitBuilder delete​(java.lang.String key)
        Adds a delete operation to the current commit.
        Parameters:
        key - key's name to delete
        Returns:
        the builder instance
      • delete

        public CommitBuilder delete​(org.projectnessie.versioned.Key key)
        Adds a delete operation to the current commit.
        Parameters:
        key - key to delete
        Returns:
        the builder instance
      • unchanged

        public CommitBuilder unchanged​(java.lang.String key)
        Adds an unchanged operation to the current commit.
        Parameters:
        key - key's name for the operation
        Returns:
        the builder instance
      • unchanged

        public CommitBuilder unchanged​(org.projectnessie.versioned.Key key)
        Adds an unchanged operation to the current commit.
        Parameters:
        key - key for the operation
        Returns:
        the builder instance
      • add

        public CommitBuilder add​(org.projectnessie.versioned.Operation operation)
        Adds an operation to the current commit.
        Parameters:
        operation - operation to commit
        Returns:
        the builder instance
      • withMetadata

        public CommitBuilder withMetadata​(org.projectnessie.model.CommitMeta metadata)
        Sets metadata for the current commit.
        Parameters:
        metadata - metadata to associate with the commit
        Returns:
        the builder instance
      • fromReference

        public CommitBuilder fromReference​(org.projectnessie.versioned.Hash reference)
        Sets a reference to base the commit on.
        Parameters:
        reference - the reference's hash
        Returns:
        the builder instance
      • fromLatest

        public CommitBuilder fromLatest()
        Uses the latest remote hash as a reference to base the commit on.
        Returns:
        the builder instance
      • toBranch

        public org.projectnessie.versioned.Hash toBranch​(org.projectnessie.versioned.BranchName branchName)
                                                  throws org.projectnessie.versioned.ReferenceNotFoundException,
                                                         org.projectnessie.versioned.ReferenceConflictException
        Pushes the commit to the branch.
        Parameters:
        branchName - the branch
        Returns:
        the hash associated with the commit
        Throws:
        org.projectnessie.versioned.ReferenceNotFoundException
        org.projectnessie.versioned.ReferenceConflictException