
run.halo.app.theme.router.UrlContextListResult Maven / Gradle / Ivy
package run.halo.app.theme.router;
import java.util.List;
import lombok.Getter;
import lombok.ToString;
import run.halo.app.extension.ListResult;
/**
* Page wrapper with next and previous url.
*
* @param the type of the list item.
* @author guqing
* @since 2.0.0
*/
@Getter
@ToString(callSuper = true)
public class UrlContextListResult extends ListResult {
private final String nextUrl;
private final String prevUrl;
public UrlContextListResult(int page, int size, long total, List items, String nextUrl,
String prevUrl) {
super(page, size, total, items);
this.nextUrl = nextUrl;
this.prevUrl = prevUrl;
}
public static class Builder {
private int page;
private int size;
private long total;
private List items;
private String nextUrl;
private String prevUrl;
public Builder page(int page) {
this.page = page;
return this;
}
public Builder size(int size) {
this.size = size;
return this;
}
public Builder total(long total) {
this.total = total;
return this;
}
public Builder items(List items) {
this.items = items;
return this;
}
public Builder nextUrl(String nextUrl) {
this.nextUrl = nextUrl;
return this;
}
public Builder prevUrl(String prevUrl) {
this.prevUrl = prevUrl;
return this;
}
/**
* Assign value with list result.
*
* @param listResult list result
* @return builder
*/
public Builder listResult(ListResult listResult) {
this.page = listResult.getPage();
this.size = listResult.getSize();
this.total = listResult.getTotal();
this.items = listResult.getItems();
return this;
}
public UrlContextListResult build() {
return new UrlContextListResult<>(page, size, total, items, nextUrl, prevUrl);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy