删除 jackson-annotations 依赖。

dev
ZhouXY108 2024-04-07 16:45:40 +08:00
parent 292e982ab2
commit b08562adaf
3 changed files with 19 additions and 12 deletions

View File

@ -13,7 +13,6 @@
<java.version>8</java.version> <java.version>8</java.version>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<jackson.version>2.13.5</jackson.version>
<commons-lang3.version>3.13.0</commons-lang3.version> <commons-lang3.version>3.13.0</commons-lang3.version>
<guava.version>32.1.3-jre</guava.version> <guava.version>32.1.3-jre</guava.version>
<google-jsr305.version>3.0.2</google-jsr305.version> <google-jsr305.version>3.0.2</google-jsr305.version>
@ -21,12 +20,6 @@
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.google.guava</groupId> <groupId>com.google.guava</groupId>
<artifactId>guava</artifactId> <artifactId>guava</artifactId>

View File

@ -16,11 +16,11 @@
package xyz.zhouxy.plusone.commons.domain; package xyz.zhouxy.plusone.commons.domain;
import java.util.Objects;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import xyz.zhouxy.plusone.commons.util.RegexTools; import xyz.zhouxy.plusone.commons.util.RegexTools;
@ -37,7 +37,7 @@ public abstract class ValidatableStringRecord
protected ValidatableStringRecord(String value, Pattern pattern) { protected ValidatableStringRecord(String value, Pattern pattern) {
Preconditions.checkNotNull(pattern, "The pattern must not be null."); Preconditions.checkNotNull(pattern, "The pattern must not be null.");
Preconditions.checkArgument(StringUtils.isNotBlank(value), "The value must be has text."); Preconditions.checkNotNull(StringUtils.isNotBlank(value), "The value must not be null.");
Preconditions.checkArgument(RegexTools.matches(value, pattern)); Preconditions.checkArgument(RegexTools.matches(value, pattern));
this.value = value; this.value = value;
} }
@ -47,7 +47,6 @@ public abstract class ValidatableStringRecord
* *
* @return * @return
*/ */
@JsonValue
public final String value() { public final String value() {
return this.value; return this.value;
} }
@ -57,6 +56,23 @@ public abstract class ValidatableStringRecord
return this.value.compareTo(o.value); return this.value.compareTo(o.value);
} }
@Override
public int hashCode() {
return Objects.hash(value);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ValidatableStringRecord other = (ValidatableStringRecord) obj;
return Objects.equals(value, other.value);
}
@Override @Override
public String toString() { public String toString() {
return this.value(); return this.value();

View File

@ -21,7 +21,6 @@ import java.util.function.Supplier;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
/** /**
@ -31,7 +30,6 @@ import com.google.common.base.Preconditions;
* @deprecated {@link UnifiedResponse} * @deprecated {@link UnifiedResponse}
*/ */
@Deprecated @Deprecated
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RestfulResult { public class RestfulResult {
public static final int SUCCESS_STATUS = 2000000; public static final int SUCCESS_STATUS = 2000000;