Package com.jcabi.github
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.github.FileChange
FileChange.Smart, FileChange.Status
-
-
Constructor Summary
Constructors Constructor Description Smart(FileChange chng)Public ctor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intadditions()Number of lines added, or 0 if the file is binary.StringblobUrl()URL for the file's git blob.intchanges()Number of lines modified, which is equal to the sum ofadditions()anddeletions().StringcontentsUrl()Repo contents URL for the file.intdeletions()Number of lines deleted, or 0 if the file is binary.Stringfilename()File's name.javax.json.JsonObjectjson()Describe it in a JSON object.com.google.common.base.Optional<String>patch()Diff string of the changes to the file.StringrawUrl()URL for the raw contents of the file.Stringsha()File's commit SHA.FileChange.Statusstatus()Status of the file in this change.
-
-
-
Constructor Detail
-
Smart
public Smart(FileChange chng)
Public ctor.- Parameters:
chng- File change
-
-
Method Detail
-
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 IOExceptionNumber 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 IOExceptionNumber 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 IOExceptionNumber of lines modified, which is equal to the sum ofadditions()anddeletions().- 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 javax.json.JsonObject json() throws IOExceptionDescription copied from interface:JsonReadableDescribe it in a JSON object.- Specified by:
jsonin interfaceJsonReadable- Returns:
- JSON object
- Throws:
IOException- If there is any I/O problem
-
-