public interface

CommentThreadDiffAnchor

com.atlassian.bitbucket.comment.CommentThreadDiffAnchor

Class Overview

The location in a diff a comment thread is anchored to.

Summary

Constants
int NO_LINE
Public Methods
@Nonnull CommentThreadDiffAnchorType getDiffType()
@Nonnull Optional<DiffFileType> getFileType()
File type this anchor is anchored to in a diff.
@Nonnull Optional<String> getFromHash()
int getLine()
@Nonnull Optional<DiffSegmentType> getLineType()
@Nonnull String getPath()
@Nonnull Optional<String> getSrcPath()
The original path at which the content pointed to by this anchor originated, or empty() if the change was not one that produces a new path.
@Nonnull String getToHash()
boolean isFileAnchor()
boolean isLineAnchor()
boolean isOrphaned()
An orphaned anchor point is out-of-date in the current state of a diff.

Constants

public static final int NO_LINE

Constant Value: 0 (0x00000000)

Public Methods

@Nonnull public CommentThreadDiffAnchorType getDiffType ()

Returns
  • the diff type associated with this anchor

@Nonnull public Optional<DiffFileType> getFileType ()

File type this anchor is anchored to in a diff.

The following relationship with getLineType() occurs:

  • for REMOVED this will always be FROM
  • for ADDED this will always be TO
  • for CONTEXT the anchor can be hooked to any of the diff files

Returns
  • type of the file this anchor is anchored to in a diff. It will only be present if this is a line anchor
See Also

@Nonnull public Optional<String> getFromHash ()

public int getLine ()

@Nonnull public Optional<DiffSegmentType> getLineType ()

Returns
  • type of the line this anchor is anchored to. It will only be present if this is a line anchor
See Also

@Nonnull public String getPath ()

Returns
  • the path to the contents this anchor points to

@Nonnull public Optional<String> getSrcPath ()

The original path at which the content pointed to by this anchor originated, or empty() if the change was not one that produces a new path.

Returns
  • the original path of the contents referred to by this anchor

@Nonnull public String getToHash ()

public boolean isFileAnchor ()

Returns
  • true, if this is a file comment anchor, i.e. an anchor associated with the whole file rather than a particular line. true implies that isLineAnchor() returns false.
See Also

public boolean isLineAnchor ()

Returns
  • true, if this is a line comment anchor, i.e. an anchor associated with a particular line in the file. true implies that isFileAnchor() returns false.
See Also

public boolean isOrphaned ()

An orphaned anchor point is out-of-date in the current state of a diff. E.g. the anchor points to a path that is no longer in scope of the pull request, because the changes to that file have been reverted on the source branch.

Returns
  • true, if the anchor is orphaned, false otherwise