diff --git a/src/main/java/com/springboot/ratelimiter/common/model/dto/request/CustomPagingRequest.java b/src/main/java/com/springboot/ratelimiter/common/model/dto/request/CustomPagingRequest.java index 7735697..146ea66 100644 --- a/src/main/java/com/springboot/ratelimiter/common/model/dto/request/CustomPagingRequest.java +++ b/src/main/java/com/springboot/ratelimiter/common/model/dto/request/CustomPagingRequest.java @@ -8,6 +8,9 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; +/** + * Class named {@link CustomPagingRequest} representing a custom paging request. + */ @Getter @Setter @SuperBuilder @@ -16,6 +19,11 @@ public class CustomPagingRequest { private CustomPaging pagination; + /** + * Converts the custom paging request to a Pageable object. + * + * @return the Pageable object + */ public Pageable toPageable() { return PageRequest.of( Math.toIntExact(pagination.getPageNumber()), diff --git a/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomPagingResponse.java b/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomPagingResponse.java index f9c542d..c0dc1d7 100644 --- a/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomPagingResponse.java +++ b/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomPagingResponse.java @@ -6,6 +6,11 @@ import java.util.List; +/** + * Class named {@link CustomPagingResponse} representing a custom paging response. + * + * @param the type of content in the response + */ @Getter @Builder public class CustomPagingResponse { @@ -20,8 +25,20 @@ public class CustomPagingResponse { private Integer totalPageCount; + /** + * Builder class for CustomPagingResponse. + * + * @param the type of content in the response + */ public static class CustomPagingResponseBuilder { + /** + * Sets the fields of the CustomPagingResponseBuilder based on the provided CustomPage. + * + * @param customPage the CustomPage object + * @param the type of content in the CustomPage + * @return the CustomPagingResponseBuilder + */ public CustomPagingResponseBuilder of(final CustomPage customPage) { return CustomPagingResponse.builder() .pageNumber(customPage.getPageNumber()) diff --git a/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomResponse.java b/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomResponse.java index f9f6d5a..fb17855 100644 --- a/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomResponse.java +++ b/src/main/java/com/springboot/ratelimiter/common/model/dto/response/CustomResponse.java @@ -8,6 +8,11 @@ import java.time.LocalDateTime; +/** + * Class named {@link CustomResponse} representing a custom response. + * + * @param the type of the response content + */ @Getter @Builder public class CustomResponse { @@ -27,7 +32,13 @@ public class CustomResponse { .isSuccess(true) .build(); - + /** + * Creates a success response with the given content. + * + * @param response the response content + * @param the type of the response content + * @return the CustomResponse object + */ public static CustomResponse ok(E response) { return CustomResponse.builder() .response(response) @@ -36,6 +47,13 @@ public static CustomResponse ok(E response) { .build(); } + /** + * Creates a created response with the given content. + * + * @param response the response content + * @param the type of the response content + * @return the CustomResponse object + */ @ResponseStatus(HttpStatus.CREATED) public static CustomResponse created(E response) { return CustomResponse.builder() diff --git a/src/main/java/com/springboot/ratelimiter/common/model/page/CustomPaging.java b/src/main/java/com/springboot/ratelimiter/common/model/page/CustomPaging.java index f0e79c5..afe7e0f 100644 --- a/src/main/java/com/springboot/ratelimiter/common/model/page/CustomPaging.java +++ b/src/main/java/com/springboot/ratelimiter/common/model/page/CustomPaging.java @@ -7,6 +7,9 @@ import lombok.Setter; import lombok.experimental.SuperBuilder; +/** + * Class named {@link CustomPaging} representing custom paging information. + */ @Getter @Setter @NoArgsConstructor @@ -20,6 +23,11 @@ public class CustomPaging { @Min(value = 1, message = "Page size must be bigger than 0") private Integer pageSize; + /** + * Gets the zero-based page number. + * + * @return the zero-based page number + */ public Integer getPageNumber() { return pageNumber - 1; }