4 Commits

Author SHA1 Message Date
f84051aa6b build: 保持开发分支的版本后缀标识为 SNAPSHOT 2026-05-28 23:35:44 +08:00
38ae9bd523 release/1.0.0-RC4 [plusone/plusone-validator#21 (Gitea)] 2026-05-28 23:32:05 +08:00
7330e28579 docs: 简化作者信息格式 2026-05-28 23:24:09 +08:00
d73b8f445d feat: 添加 Maven 发布插件配置并更新版本
添加flatten-maven-plugin用于生成完整的POM文件以支持OSS发布,
并移除重复的开发者信息配置,
添加GPG签名和Central发布插件配置到release profile中,
同时更新父POM和子模块版本从SNAPSHOT到RC4。
2026-05-28 23:23:58 +08:00
25 changed files with 89 additions and 88 deletions

2
.gitignore vendored
View File

@@ -4,6 +4,8 @@ target/
!**/src/main/**/target/
!**/src/test/**/target/
.flattened-pom.xml
### STS ###
.apt_generated
.classpath

View File

@@ -9,6 +9,7 @@
<groupId>xyz.zhouxy.plusone</groupId>
<artifactId>plusone-validator-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>plusone-validator</artifactId>
@@ -18,27 +19,6 @@
Plusone Validator 是一个校验库,使用 lambda 表达式(包括方法引用)和流式 API 构建校验规则,对对象进行校验。
</description>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Zhou Xingyi (周兴毅)</name>
<url>https://gitea.zhouxy.xyz/plusone</url>
</developer>
</developers>
<scm>
<connection>scm:git:https://gitea.zhouxy.xyz/plusone/plusone-validator.git</connection>
<developerConnection>scm:git:ssh://gitea.zhouxy.xyz/plusone/plusone-validator.git</developerConnection>
<url>https://gitea.zhouxy.xyz/plusone/plusone-validator</url>
</scm>
<dependencies>
<dependency>
<groupId>xyz.zhouxy.plusone</groupId>

View File

@@ -31,7 +31,7 @@ import xyz.zhouxy.plusone.commons.util.AssertTools;
*
* @param <T> 待校验对象的类型
* @param <E> 数组元素的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class ArrayPropertyValidator<T, E>
extends BasePropertyValidator<T, E[], ArrayPropertyValidator<T, E>> {

View File

@@ -29,7 +29,7 @@ import com.google.common.collect.Range;
* @param <TProperty> 待校验属性的类型,必须实现 {@code Comparable} 接口
* @param <TPropertyValidator> 具体校验器类型,用于支持链式调用
* @see Range
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public abstract class BaseComparablePropertyValidator<
T,

View File

@@ -33,7 +33,7 @@ import java.util.function.Supplier;
* @param <T> 待校验对象的类型
* @param <TProperty> 待校验属性的类型
* @param <TPropertyValidator> 具体校验器类型,用于支持链式调用
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public abstract class BasePropertyValidator<
T,

View File

@@ -34,7 +34,7 @@ import xyz.zhouxy.plusone.validator.function.*;
* 子类可通过添加不同的校验规则,构建完整的校验逻辑,用于校验对象。
*
* @param <T> 待校验对象的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public abstract class BaseValidator<T> implements IValidator<T> {

View File

@@ -27,7 +27,7 @@ import java.util.function.Supplier;
* 用于构建校验 {@code Boolean} 类型属性的规则链。
*
* @param <T> 待校验对象的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class BoolPropertyValidator<T>
extends BasePropertyValidator<T, Boolean, BoolPropertyValidator<T>> {

View File

@@ -32,7 +32,7 @@ import xyz.zhouxy.plusone.commons.util.AssertTools;
*
* @param <T> 待校验对象的类型
* @param <E> 集合元素的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class CollectionPropertyValidator<T, E>
extends BasePropertyValidator<T, Collection<E>, CollectionPropertyValidator<T, E>> {

View File

@@ -24,7 +24,7 @@ import java.util.function.Function;
* @param <T> 待校验对象的类型
* @param <TProperty> 待校验属性的类型,必须实现 {@code Comparable} 接口
* @see com.google.common.collect.Range
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class ComparablePropertyValidator<T, TProperty extends Comparable<? super TProperty>>
extends BaseComparablePropertyValidator<T, TProperty, ComparablePropertyValidator<T, TProperty>> {

View File

@@ -27,7 +27,7 @@ import java.util.function.Supplier;
* 用于构建校验 {@code Double} 类型属性的规则链。
*
* @param <T> 待校验对象的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class DoublePropertyValidator<T>
extends BaseComparablePropertyValidator<T, Double, DoublePropertyValidator<T>> {

View File

@@ -19,7 +19,7 @@ package xyz.zhouxy.plusone.validator;
/**
* 自带校验方法,校验不通过时直接抛异常。
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*
* @see BaseValidator
*/

View File

@@ -23,7 +23,7 @@ package xyz.zhouxy.plusone.validator;
* </p>
*
* @param <T> 待校验对象的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public interface IValidator<T> {

View File

@@ -27,7 +27,7 @@ import java.util.function.Supplier;
* 用于构建校验 {@code Integer} 类型属性的规则链。
*
* @param <T> 待校验对象的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class IntPropertyValidator<T>
extends BaseComparablePropertyValidator<T, Integer, IntPropertyValidator<T>> {

View File

@@ -27,7 +27,7 @@ import java.util.function.Supplier;
* 用于构建校验 {@code Long} 类型属性的规则链。
*
* @param <T> 待校验对象的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class LongPropertyValidator<T>
extends BaseComparablePropertyValidator<T, Long, LongPropertyValidator<T>> {

View File

@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
* <p>
* 校验后拷贝出一个新的 Map 对象,仅保留指定的 key。
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public abstract class MapValidator<K, V> extends BaseValidator<Map<K, V>> {

View File

@@ -23,7 +23,7 @@ import java.util.function.Function;
*
* @param <T> 待校验对象的类型
* @param <TProperty> 待校验属性的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class ObjectPropertyValidator<T, TProperty>
extends BasePropertyValidator<T, TProperty, ObjectPropertyValidator<T, TProperty>> {

View File

@@ -27,7 +27,7 @@ import java.util.function.Supplier;
* @param <T> 被验证对象类型
* @param <V1> 第一个元素的类型
* @param <V2> 第二个元素的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class PairPropertyValidator<T, V1, V2>
extends BasePropertyValidator<T, Entry<V1, V2>, PairPropertyValidator<T, V1, V2>> {

View File

@@ -35,7 +35,7 @@ import xyz.zhouxy.plusone.commons.util.StringTools;
* 用于构建校验 {@code String} 类型属性的规则链。
*
* @param <T> 待校验对象的类型
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class StringPropertyValidator<T>
extends BaseComparablePropertyValidator<T, String, StringPropertyValidator<T>> {

View File

@@ -18,7 +18,7 @@ package xyz.zhouxy.plusone.validator;
/**
* 校验失败异常
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
public class ValidationException extends RuntimeException {

View File

@@ -21,7 +21,7 @@ import java.util.function.Function;
/**
* Function&lt;T, Boolean&gt;
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
@FunctionalInterface
public interface ToBoolObjectFunction<T> extends Function<T, Boolean>, Serializable {

View File

@@ -21,7 +21,7 @@ import java.util.function.Function;
/**
* Function&lt;T, Double&gt;
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
@FunctionalInterface
public interface ToDoubleObjectFunction<T> extends Function<T, Double>, Serializable {

View File

@@ -21,7 +21,7 @@ import java.util.function.Function;
/**
* Function&lt;T, Integer&gt;
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
@FunctionalInterface
public interface ToIntegerFunction<T> extends Function<T, Integer>, Serializable {

View File

@@ -21,7 +21,7 @@ import java.util.function.Function;
/**
* Function&lt;T, Long&gt;
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
@FunctionalInterface
public interface ToLongObjectFunction<T> extends Function<T, Long>, Serializable {

View File

@@ -21,7 +21,7 @@ import java.util.function.Function;
/**
* Function&lt;T, String&gt;
*
* @author ZhouXY108 <luquanlion@outlook.com>
* @author ZhouXY
*/
@FunctionalInterface
public interface ToStringFunction<T> extends Function<T, String>, Serializable {

109
pom.xml
View File

@@ -47,7 +47,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<plusone-commons.version>1.1.0-SNAPSHOT</plusone-commons.version>
<plusone-commons.version>1.1.0-RC2</plusone-commons.version>
</properties>
<dependencyManagement>
@@ -68,49 +68,68 @@
</dependencyManagement>
<build>
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<pluginManagement>
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Flatten 插件:生成包含继承信息的完整 POM 用于发布 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<!-- 核心配置oss 模式专为 Sonatype/Maven Central 设计 -->
<!-- 它会保留 url, licenses, developers, scm, properties 等必要元素 -->
<flattenMode>oss</flattenMode>
</configuration>
<executions>
<!-- 在 process-resources 阶段生成展平的 POM -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- 在 clean 阶段删除展平的 POM -->
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<!-- GPG -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>