code: void apply(UpdateableSegmentMetadata target) {
          if (!this.isChanged) {
              // No changes made.
              return;
          }
  
          Preconditions.checkArgument(target.getId() == this.id,
                  "Target Segment Id mismatch. Expected %s, given %s.", this.id, target.getId());
          Preconditions.checkArgument(target.getName().equals(this.name),
                  "Target Segment Name mismatch. Expected %s, given %s.", name, target.getName());
  
          // Apply to base metadata.
          target.setLastUsed(this.lastUsed);
          target.updateAttributes(this.attributeUpdates);
          target.setLength(this.length);
  
          // Update StartOffset after (potentially) updating the length, since he Start Offset must be less than or equal to Length.
          target.setStartOffset(this.startOffset);
          if (this.storageLength >= 0) {
              // Only update this if it really was set. Otherwise we might revert back to an old value if the Writer
              // has already made progress on it.
              target.setStorageLength(this.storageLength);
          }
  
          if (this.sealed) {
              target.markSealed();
              if (this.sealedInStorage) {
                  target.markSealedInStorage();
              }
          }
  
          if (this.merged) {
              target.markMerged();
          }
  
          if (this.deleted) {
              target.markDeleted();
              if (this.deletedInStorage) {
                  target.markDeletedInStorage();
              }
          }
  
          if (this.pinned) {
              target.markPinned();
          }
      }
docs: Applies all the outstanding changes to the base SegmentMetadata object.