Skip to content

Commit

Permalink
Task 28 : Add Java Doc for CustomError, CustomPage
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapter1990 committed Jul 2, 2024
1 parent b897310 commit 2fb0db2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import java.time.LocalDateTime;
import java.util.List;

/**
* Represents a custom error as {@link CustomError} with details such as timestamp, HTTP status, header, message, and sub-errors.
*/
@Getter
@Builder
public class CustomError {
Expand All @@ -29,6 +32,9 @@ public class CustomError {
@JsonInclude(JsonInclude.Include.NON_NULL)
private List<CustomSubError> subErrors;

/**
* Represents a sub-error as {@link CustomSubError} with details such as message, field, value, and type.
*/
@Getter
@Builder
public static class CustomSubError {
Expand All @@ -45,6 +51,9 @@ public static class CustomSubError {

}

/**
* Represents the headers as {@link Header} used for categorizing errors.
*/
@Getter
@RequiredArgsConstructor
public enum Header {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

import java.util.List;

/**
* Class named {@link CustomPage} representing a custom page of data.
*
* @param <T> the type of content in the page
*/
@Getter
@Setter
@Builder
Expand All @@ -21,7 +26,15 @@ public class CustomPage<T> {

private Integer totalPageCount;


/**
* Creates a CustomPage from a list of domain models and a Page object.
*
* @param domainModels the list of domain models
* @param page the Page object
* @param <C> the type of domain models
* @param <X> the type of the Page content
* @return the CustomPage object
*/
public static <C, X> CustomPage<C> of(final List<C> domainModels, final Page<X> page) {
return CustomPage.<C>builder()
.content(domainModels)
Expand Down

0 comments on commit 2fb0db2

Please sign in to comment.