-
Notifications
You must be signed in to change notification settings - Fork 485
Better support for DiffNote type (line_range in Position, suggestions, ...) #1286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
135 changes: 135 additions & 0 deletions
135
gitlab4j-models/src/main/java/org/gitlab4j/api/models/LineRange.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| package org.gitlab4j.api.models; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| import org.gitlab4j.models.utils.JacksonJson; | ||
| import org.gitlab4j.models.utils.JacksonJsonEnumHelper; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonValue; | ||
|
|
||
| public class LineRange implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| public static class Position implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| public static enum PositionType { | ||
| OLD, | ||
| NEW; | ||
| private static JacksonJsonEnumHelper<PositionType> enumHelper = | ||
| new JacksonJsonEnumHelper<>(PositionType.class, false, false); | ||
|
|
||
| @JsonCreator | ||
| public static PositionType forValue(String value) { | ||
| return enumHelper.forValue(value); | ||
| } | ||
|
|
||
| @JsonValue | ||
| public String toValue() { | ||
| return (enumHelper.toString(this)); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return (enumHelper.toString(this)); | ||
| } | ||
| } | ||
|
|
||
| private String lineCode; | ||
| private PositionType type; | ||
| private Integer oldLine; | ||
| private Integer newLine; | ||
|
|
||
| public String getLineCode() { | ||
| return lineCode; | ||
| } | ||
|
|
||
| public void setLineCode(String lineCode) { | ||
| this.lineCode = lineCode; | ||
| } | ||
|
|
||
| public Position withLineCode(String lineCode) { | ||
| this.lineCode = lineCode; | ||
| return this; | ||
| } | ||
|
|
||
| public PositionType getType() { | ||
| return type; | ||
| } | ||
|
|
||
| public void setType(PositionType type) { | ||
| this.type = type; | ||
| } | ||
|
|
||
| public Position withType(PositionType type) { | ||
| this.type = type; | ||
| return this; | ||
| } | ||
|
|
||
| public Integer getOldLine() { | ||
| return oldLine; | ||
| } | ||
|
|
||
| public void setOldLine(Integer oldLine) { | ||
| this.oldLine = oldLine; | ||
| } | ||
|
|
||
| public Position withOldLine(Integer oldLine) { | ||
| this.oldLine = oldLine; | ||
| return this; | ||
| } | ||
|
|
||
| public Integer getNewLine() { | ||
| return newLine; | ||
| } | ||
|
|
||
| public void setNewLine(Integer newLine) { | ||
| this.newLine = newLine; | ||
| } | ||
|
|
||
| public Position withNewLine(Integer newLine) { | ||
| this.newLine = newLine; | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return (JacksonJson.toJsonString(this)); | ||
| } | ||
| } | ||
|
|
||
| private Position start; | ||
| private Position end; | ||
|
|
||
| public Position getStart() { | ||
| return start; | ||
| } | ||
|
|
||
| public void setStart(Position start) { | ||
| this.start = start; | ||
| } | ||
|
|
||
| public LineRange withStart(Position start) { | ||
| this.start = start; | ||
| return this; | ||
| } | ||
|
|
||
| public Position getEnd() { | ||
| return end; | ||
| } | ||
|
|
||
| public void setEnd(Position end) { | ||
| this.end = end; | ||
| } | ||
|
|
||
| public LineRange withEnd(Position end) { | ||
| this.end = end; | ||
| return this; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return (JacksonJson.toJsonString(this)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
gitlab4j-models/src/main/java/org/gitlab4j/api/models/Suggestion.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| package org.gitlab4j.api.models; | ||
|
|
||
| import java.io.Serializable; | ||
|
|
||
| import org.gitlab4j.models.utils.JacksonJson; | ||
|
|
||
| public class Suggestion implements Serializable { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| private Long id; | ||
| private Long fromLine; | ||
| private Long toLine; | ||
| private Boolean appliable; | ||
| private Boolean applied; | ||
| private String fromContent; | ||
| private String toContent; | ||
|
|
||
| public Long getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Long id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public Long getFromLine() { | ||
| return fromLine; | ||
| } | ||
|
|
||
| public void setFromLine(Long fromLine) { | ||
| this.fromLine = fromLine; | ||
| } | ||
|
|
||
| public Long getToLine() { | ||
| return toLine; | ||
| } | ||
|
|
||
| public void setToLine(Long toLine) { | ||
| this.toLine = toLine; | ||
| } | ||
|
|
||
| public Boolean getAppliable() { | ||
| return appliable; | ||
| } | ||
|
|
||
| public void setAppliable(Boolean appliable) { | ||
| this.appliable = appliable; | ||
| } | ||
|
|
||
| public Boolean getApplied() { | ||
| return applied; | ||
| } | ||
|
|
||
| public void setApplied(Boolean applied) { | ||
| this.applied = applied; | ||
| } | ||
|
|
||
| public String getFromContent() { | ||
| return fromContent; | ||
| } | ||
|
|
||
| public void setFromContent(String fromContent) { | ||
| this.fromContent = fromContent; | ||
| } | ||
|
|
||
| public String getToContent() { | ||
| return toContent; | ||
| } | ||
|
|
||
| public void setToContent(String toContent) { | ||
| this.toContent = toContent; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return (JacksonJson.toJsonString(this)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is probably a test case in TestGitLabApiBeans testing that the java class Position can be serialized and serialized.
It would be good to extend this test (probably extend the JSON used by the test, to reflect this change)