Skip to content

Commit e8d6d21

Browse files
claude[bot]github-actions[bot]claude
authored
Maintenance: ApiResponse and ErrorMessage - Modernize with Lombok (#92)
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <[email protected]>
1 parent 399649c commit e8d6d21

File tree

3 files changed

+7
-30
lines changed

3 files changed

+7
-30
lines changed
Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package spring.memewikibe.support.error;
22

3-
public class ErrorMessage {
3+
import lombok.Getter;
44

5+
@Getter
6+
public final class ErrorMessage {
57
private final String code;
6-
78
private final String message;
8-
99
private final Object data;
1010

1111
public ErrorMessage(ErrorType errorType) {
@@ -19,16 +19,4 @@ public ErrorMessage(ErrorType errorType, Object data) {
1919
this.message = errorType.getMessage();
2020
this.data = data;
2121
}
22-
23-
public String getCode() {
24-
return code;
25-
}
26-
27-
public String getMessage() {
28-
return message;
29-
}
30-
31-
public Object getData() {
32-
return data;
33-
}
3422
}

src/main/java/spring/memewikibe/support/error/ErrorType.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public enum ErrorType {
1818
EXTERNAL_SERVICE_TOO_MANY_REQUESTS(
1919
HttpStatus.TOO_MANY_REQUESTS, ErrorCode.E429, "외부 서비스 요청 한도가 초과되었습니다.", LogLevel.WARN),
2020
EXTERNAL_SERVICE_BAD_REQUEST(
21-
HttpStatus.BAD_REQUEST, ErrorCode.E400, "외부 서비스 요청이 올바르지 않습니다.", LogLevel.WARN),
22-
;
21+
HttpStatus.BAD_REQUEST, ErrorCode.E400, "외부 서비스 요청이 올바르지 않습니다.", LogLevel.WARN);
2322

2423
private final HttpStatus status;
2524

src/main/java/spring/memewikibe/support/response/ApiResponse.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package spring.memewikibe.support.response;
22

3+
import lombok.Getter;
34
import spring.memewikibe.support.error.ErrorMessage;
45
import spring.memewikibe.support.error.ErrorType;
56

6-
public class ApiResponse<S> {
7+
@Getter
8+
public final class ApiResponse<S> {
79
private final ResultType resultType;
810
private final S success;
911
private final ErrorMessage error;
@@ -29,16 +31,4 @@ public static ApiResponse<?> error(ErrorType error) {
2931
public static ApiResponse<?> error(ErrorType error, Object errorData) {
3032
return new ApiResponse<>(ResultType.ERROR, null, new ErrorMessage(error, errorData));
3133
}
32-
33-
public ResultType getResultType() {
34-
return resultType;
35-
}
36-
37-
public S getSuccess() {
38-
return success;
39-
}
40-
41-
public ErrorMessage getError() {
42-
return error;
43-
}
4434
}

0 commit comments

Comments
 (0)