-
Notifications
You must be signed in to change notification settings - Fork 14.6k
MINOR: Cleanup Trogdor Module #20214
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
Changes from 3 commits
09e1db2
0ecb4b6
b4eb767
2575f47
e46cd19
9d24dcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,46 +22,29 @@ | |
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* An error response. | ||
*/ | ||
public class ErrorResponse { | ||
private final int code; | ||
private final String message; | ||
|
||
public record ErrorResponse(int code, String message) { | ||
@JsonCreator | ||
public ErrorResponse(@JsonProperty("code") int code, | ||
@JsonProperty("message") String message) { | ||
this.code = code; | ||
this.message = message; | ||
} | ||
|
||
@Override | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nicely done, thanks. Until taken care by plugin it can happen anytime leaving this task kind of open. Offering to apply thins kind of conventions via rewrite. |
||
@JsonProperty | ||
public int code() { | ||
return code; | ||
} | ||
|
||
@Override | ||
@JsonProperty | ||
public String message() { | ||
return message; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ErrorResponse that = (ErrorResponse) o; | ||
return Objects.equals(code, that.code) && | ||
Objects.equals(message, that.message); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(code, message); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return JsonUtil.toJsonString(this); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,13 @@ | |
/** | ||
* The request to /coordinator/tasks/{taskId} | ||
*/ | ||
public class TaskRequest { | ||
private final String taskId; | ||
|
||
public record TaskRequest(String taskId) { | ||
@JsonCreator | ||
public TaskRequest(@JsonProperty("taskId") String taskId) { | ||
this.taskId = taskId == null ? "" : taskId; | ||
} | ||
|
||
@Override | ||
@JsonProperty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. considering Can not tell anything about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @chia7712 , I agree, both of the annotations are unnexcessary. Dropped them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the inspiration. False positive(s) should be covered as well. |
||
public String taskId() { | ||
sjhajharia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return taskId; | ||
|
Uh oh!
There was an error while loading. Please reload this page.