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 int
additions()
Number of lines added, or 0 if the file is binary.String
blobUrl()
URL for the file's git blob.int
changes()
Number of lines modified, which is equal to the sum ofadditions()
anddeletions()
.String
contentsUrl()
Repo contents URL for the file.int
deletions()
Number of lines deleted, or 0 if the file is binary.String
filename()
File's name.javax.json.JsonObject
json()
Describe it in a JSON object.com.google.common.base.Optional<String>
patch()
Diff string of the changes to the file.String
rawUrl()
URL for the raw contents of the file.String
sha()
File's commit SHA.FileChange.Status
status()
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 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 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 IOException
Description copied from interface:JsonReadable
Describe it in a JSON object.- Specified by:
json
in interfaceJsonReadable
- Returns:
- JSON object
- Throws:
IOException
- If there is any I/O problem
-
-