-
Notifications
You must be signed in to change notification settings - Fork 6
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
refactor : SliceParam 제거 #281
Conversation
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.
엘쥐티엠~
import java.util.List; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.domain.Slice; | ||
import org.springframework.data.domain.SliceImpl; | ||
|
||
public class SliceUtil { | ||
// 리스트를 슬라이스로 변환 | ||
public static <T> Slice<T> valueOf(List<T> contents, Pageable pageable) { | ||
boolean hasNext = hasNext(contents, pageable); | ||
return new SliceImpl<>( | ||
hasNext ? getContent(contents, pageable) : contents, pageable, hasNext); | ||
} | ||
|
||
// 다음 페이지 있는지 확인 | ||
private static <T> boolean hasNext(List<T> content, Pageable pageable) { | ||
return pageable.isPaged() && content.size() > pageable.getPageSize(); | ||
} | ||
|
||
// 데이터 1개 빼고 반환 | ||
private static <T> List<T> getContent(List<T> content, Pageable pageable) { | ||
return content.subList(0, pageable.getPageSize()); | ||
} | ||
} |
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.
와우 좋습니다! 최고!!
Kudos, SonarCloud Quality Gate passed! 0 Bugs |
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.
Slice 확인이요! 수고하셨어요! LGTM 👍
개요
작업사항
@DateFormat
누락 분 적용하였습니다CALCULATING("CALCULATING", "정산중")
변경로직