简单调整,并去除 lombok。

feature/net-util
ZhouXY108 2023-04-12 11:01:42 +08:00
parent 2babb5fb2d
commit 56ce9a5fa6
4 changed files with 62 additions and 29 deletions

13
pom.xml
View File

@ -12,18 +12,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<lombok.version>1.18.24</lombok.version>
<jackson.version>2.13.4</jackson.version>
<google-jsr305.version>3.0.2</google-jsr305.version>
<guava.version>31.1-jre</guava.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${google-jsr305.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@ -34,12 +27,6 @@
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>

View File

@ -18,9 +18,6 @@ package xyz.zhouxy.plusone.commons.util;
import java.util.List;
import lombok.Setter;
import lombok.ToString;
/**
*
*
@ -29,8 +26,6 @@ import lombok.ToString;
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
* @see PagingAndSortingQueryParams
*/
@ToString
@Setter
public class PageDTO<T> {
private Long total;
@ -53,4 +48,20 @@ public class PageDTO<T> {
return content;
}
// Setters
public void setTotal(Long total) {
this.total = total;
}
public void setContent(List<T> content) {
this.content = content;
}
// Setters end
@Override
public String toString() {
return "PageDTO [total=" + total + ", content=" + content + "]";
}
}

View File

@ -20,8 +20,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import lombok.Setter;
/**
*
*
@ -33,7 +31,6 @@ import lombok.Setter;
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
* @see PageDTO
*/
@Setter
public class PagingAndSortingQueryParams {
protected String orderBy;
@ -66,4 +63,19 @@ public class PagingAndSortingQueryParams {
return (getPageNum() - 1) * getSize();
}
// Setters
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public void setSize(Integer size) {
this.size = size;
}
public void setPageNum(Long pageNum) {
this.pageNum = pageNum;
}
// Setters end
}

View File

@ -21,20 +21,12 @@ import java.util.function.Supplier;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
/**
*
*
* @author <a href="https://gitee.com/zhouxy108">ZhouXY</a>
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@ToString
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class RestfulResult {
public static final int SUCCESS_STATUS = 2000000;
@ -90,6 +82,37 @@ public class RestfulResult {
return isSuccess.getAsBoolean() ? success.get() : error.get();
}
// Constructors
private RestfulResult(Object status, String message, Object data) {
this.status = status;
this.message = message;
this.data = data;
}
// Constructors end
// Getters
public Object getStatus() {
return status;
}
public String getMessage() {
return message;
}
public Object getData() {
return data;
}
// Getters end
@Override
public String toString() {
return "RestfulResult [status=" + status + ", message=" + message + ", data=" + data + "]";
}
// Builder
public static Builder successIf(final boolean condition) {
return successIf(() -> condition);