Class FileChange.Smart

java.lang.Object
com.jcabi.github.FileChange.Smart
All Implemented Interfaces:
FileChange, JsonReadable
Enclosing interface:
FileChange

@Immutable @Loggable(1) public static final class FileChange.Smart extends Object implements FileChange
Smart file change with extra features.
Since:
0.24
  • Constructor Details

    • Smart

      public Smart(FileChange chng)
      Public ctor.
      Parameters:
      chng - File change
  • Method Details

    • sha

      public String sha() throws IOException
      File's commit SHA.
      Returns:
      SHA
      Throws:
      IOException - If there is any I/O problem
    • filename

      public String filename() throws IOException
      File's name. Includes the path to the file from the root directory of the repository. Does not start with a forward slash. Example: "foo/bar/baz.txt"
      Returns:
      Filename
      Throws:
      IOException - If there is any I/O problem
    • status

      public FileChange.Status status() throws IOException
      Status of the file in this change.
      Returns:
      File status
      Throws:
      IOException - If there is any I/O problem
    • additions

      public int additions() throws IOException
      Number of lines added, or 0 if the file is binary.
      Returns:
      Number of lines added
      Throws:
      IOException - If there is any I/O problem
    • deletions

      public int deletions() throws IOException
      Number of lines deleted, or 0 if the file is binary.
      Returns:
      Number of lines deleted
      Throws:
      IOException - If there is any I/O problem
    • changes

      public int changes() throws IOException
      Number of lines modified, which is equal to the sum of additions() and deletions().
      Returns:
      Number of lines modified
      Throws:
      IOException - If there is any I/O problem
    • patch

      public com.google.common.base.Optional<String> patch() throws IOException
      Diff string of the changes to the file. Only available if the file is text (as opposed to binary).
      Returns:
      Diff string
      Throws:
      IOException - If there is any I/O problem
    • rawUrl

      public String rawUrl() throws IOException
      URL for the raw contents of the file.
      Returns:
      URL
      Throws:
      IOException - If there is any I/O problem
    • blobUrl

      public String blobUrl() throws IOException
      URL for the file's git blob.
      Returns:
      URL
      Throws:
      IOException - If there is any I/O problem
    • contentsUrl

      public String contentsUrl() throws IOException
      Repo contents URL for the file.
      Returns:
      URL
      Throws:
      IOException - If there is any I/O problem
    • json

      public jakarta.json.JsonObject json() throws IOException
      Description copied from interface: JsonReadable
      Describe it in a JSON object.
      Specified by:
      json in interface JsonReadable
      Returns:
      JSON object
      Throws:
      IOException - If there is any I/O problem