格式化代码。

This commit is contained in:
2024-10-21 23:17:52 +08:00
parent 443116a5a2
commit f4b7005b92
16 changed files with 139 additions and 120 deletions

View File

@@ -27,7 +27,7 @@ import java.lang.annotation.Documented;
* *
* <p>标识方法为不支持的操作。该方法将抛出 {@link UnsupportedOperationException}。 * <p>标识方法为不支持的操作。该方法将抛出 {@link UnsupportedOperationException}。
* *
* @author zhouxy * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
* @version 1.0 * @version 1.0
* @since 1.0 * @since 1.0
* @see UnsupportedOperationException * @see UnsupportedOperationException

View File

@@ -55,7 +55,7 @@ public final class Ref<T> {
return this.value != null; return this.value != null;
} }
public void execute(Consumer<T> consumer) { public void execute(Consumer<? super T> consumer) {
consumer.accept(value); consumer.accept(value);
} }

View File

@@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
package xyz.zhouxy.plusone.commons.model; package xyz.zhouxy.plusone.commons.model;
import java.time.LocalDate; import java.time.LocalDate;

View File

@@ -20,6 +20,8 @@ import xyz.zhouxy.plusone.commons.util.AssertTools;
/** /**
* 性别 * 性别
*
* @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/ */
public enum Gender { public enum Gender {
UNKNOWN(0, "Unknown", "未知"), UNKNOWN(0, "Unknown", "未知"),

View File

@@ -194,7 +194,7 @@ public abstract class UnifiedResponse {
/** /**
* 自定义结果 * 自定义结果
* *
* @author zhouxy * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/ */
protected static class CustomResult extends UnifiedResponse { protected static class CustomResult extends UnifiedResponse {

View File

@@ -21,7 +21,7 @@ import org.apache.ibatis.jdbc.AbstractSQL;
import com.google.common.annotations.Beta; import com.google.common.annotations.Beta;
/** /**
* @author ZhouXY * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/ */
@Beta @Beta
public abstract class SQL<T> extends AbstractSQL<T> { public abstract class SQL<T> extends AbstractSQL<T> {

View File

@@ -26,8 +26,8 @@ import xyz.zhouxy.plusone.commons.util.Numbers;
/** /**
* 季度 * 季度
* *
* @author zhouxy * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/ */
public enum Quarter { public enum Quarter {
/** 第一季度 */ /** 第一季度 */
@@ -66,7 +66,7 @@ public enum Quarter {
/** /**
* 根据给定的月份值返回对应的季度 * 根据给定的月份值返回对应的季度
* *
* @param monthValue 月份值取值范围为1到12 * @param monthValue 月份值取值范围为1到12
* @return 对应的季度 * @return 对应的季度
* @throws IllegalArgumentException 如果月份值不在有效范围内1到12将抛出异常 * @throws IllegalArgumentException 如果月份值不在有效范围内1到12将抛出异常
@@ -79,7 +79,7 @@ public enum Quarter {
/** /**
* 根据给定的月份返回对应的季度 * 根据给定的月份返回对应的季度
* *
* @param month 月份 * @param month 月份
* @return 对应的季度 * @return 对应的季度
*/ */
@@ -102,7 +102,7 @@ public enum Quarter {
/** /**
* 根据给定的季度值返回对应的季度 * 根据给定的季度值返回对应的季度
* *
* @param value 季度值 (1/2/3/4) * @param value 季度值 (1/2/3/4)
* @return 对应的季度 * @return 对应的季度
* @throws IllegalArgumentException 如果季度值不在有效范围内1到4将抛出异常 * @throws IllegalArgumentException 如果季度值不在有效范围内1到4将抛出异常
@@ -172,7 +172,7 @@ public enum Quarter {
/** /**
* 计算给定月份对应的季度值 * 计算给定月份对应的季度值
* *
* @param monthValue 月份值取值范围为1到12 * @param monthValue 月份值取值范围为1到12
* @return 对应的季度值 * @return 对应的季度值
*/ */

View File

@@ -31,10 +31,12 @@ import javax.annotation.Nonnull;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.errorprone.annotations.Immutable; import com.google.errorprone.annotations.Immutable;
import xyz.zhouxy.plusone.commons.annotation.StaticFactoryMethod;
/** /**
* 表示年份与季度 * 表示年份与季度
* *
* @author zhouxy * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/ */
@Immutable @Immutable
public final class YearQuarter implements Comparable<YearQuarter>, Serializable { public final class YearQuarter implements Comparable<YearQuarter>, Serializable {
@@ -57,6 +59,8 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
this.lastDate = quarter.lastMonthDay().atYear(year); this.lastDate = quarter.lastMonthDay().atYear(year);
} }
// #region - StaticFactoryMethod
/** /**
* 根据指定年份与季度,创建 {@link YearQuarter} 实例 * 根据指定年份与季度,创建 {@link YearQuarter} 实例
* *
@@ -64,6 +68,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
* @param quarter 季度 * @param quarter 季度
* @return {@link YearQuarter} 实例 * @return {@link YearQuarter} 实例
*/ */
@StaticFactoryMethod(YearQuarter.class)
public static YearQuarter of(int year, int quarter) { public static YearQuarter of(int year, int quarter) {
return of(year, Quarter.of(quarter)); return of(year, Quarter.of(quarter));
} }
@@ -75,6 +80,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
* @param quarter 季度 * @param quarter 季度
* @return {@link YearQuarter} 实例 * @return {@link YearQuarter} 实例
*/ */
@StaticFactoryMethod(YearQuarter.class)
public static YearQuarter of(int year, @Nonnull Quarter quarter) { public static YearQuarter of(int year, @Nonnull Quarter quarter) {
return new YearQuarter(year, quarter); return new YearQuarter(year, quarter);
} }
@@ -85,6 +91,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
* @param date 日期 * @param date 日期
* @return {@link YearQuarter} 实例 * @return {@link YearQuarter} 实例
*/ */
@StaticFactoryMethod(YearQuarter.class)
public static YearQuarter of(@Nonnull LocalDate date) { public static YearQuarter of(@Nonnull LocalDate date) {
return of(date.getYear(), Quarter.fromMonth(date.getMonth())); return of(date.getYear(), Quarter.fromMonth(date.getMonth()));
} }
@@ -95,6 +102,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
* @param date 日期 * @param date 日期
* @return {@link YearQuarter} 实例 * @return {@link YearQuarter} 实例
*/ */
@StaticFactoryMethod(YearQuarter.class)
public static YearQuarter of(@Nonnull Date date) { public static YearQuarter of(@Nonnull Date date) {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
final int year = date.getYear() + 1900; final int year = date.getYear() + 1900;
@@ -109,6 +117,7 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
* @param date 日期 * @param date 日期
* @return {@link YearQuarter} 实例 * @return {@link YearQuarter} 实例
*/ */
@StaticFactoryMethod(YearQuarter.class)
public static YearQuarter of(Calendar date) { public static YearQuarter of(Calendar date) {
return of(date.get(Calendar.YEAR), Quarter.fromMonth(date.get(Calendar.MONTH) + 1)); return of(date.get(Calendar.YEAR), Quarter.fromMonth(date.get(Calendar.MONTH) + 1));
} }
@@ -119,11 +128,14 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
* @param yearMonth 年月 * @param yearMonth 年月
* @return {@link YearQuarter} 实例 * @return {@link YearQuarter} 实例
*/ */
@StaticFactoryMethod(YearQuarter.class)
public static YearQuarter of(YearMonth yearMonth) { public static YearQuarter of(YearMonth yearMonth) {
return of(yearMonth.getYear(), Quarter.fromMonth(yearMonth.getMonth())); return of(yearMonth.getYear(), Quarter.fromMonth(yearMonth.getMonth()));
} }
// Getters // #endregion
// #region - Getters
public int getYear() { public int getYear() {
return year; return year;
@@ -165,9 +177,9 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
return lastDate; return lastDate;
} }
// Getters end // #endregion
// computes // #region - computes
public YearQuarter plusQuarters(long quartersToAdd) { // TODO 单元测试 public YearQuarter plusQuarters(long quartersToAdd) { // TODO 单元测试
if (quartersToAdd == 0) { if (quartersToAdd == 0) {
@@ -196,9 +208,9 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
return plusYears(-yearsToAdd); return plusYears(-yearsToAdd);
} }
// computes end // #endregion
// hashCode & equals // #region - hashCode & equals
@Override @Override
public int hashCode() { public int hashCode() {
@@ -217,7 +229,9 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
return year == other.year && quarter == other.quarter; return year == other.year && quarter == other.quarter;
} }
// compareTo // #endregion
// #region - compareTo
@Override @Override
public int compareTo(YearQuarter other) { public int compareTo(YearQuarter other) {
@@ -236,7 +250,9 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
return this.compareTo(other) > 0; return this.compareTo(other) > 0;
} }
// toString // #endregion
// #region - toString
/** /**
* 返回 {@link YearQuarter} 的字符串表示形式,如 "2024 Q3" * 返回 {@link YearQuarter} 的字符串表示形式,如 "2024 Q3"
@@ -247,4 +263,6 @@ public final class YearQuarter implements Comparable<YearQuarter>, Serializable
public String toString() { public String toString() {
return this.year + " " + this.quarter.name(); return this.year + " " + this.quarter.name();
} }
// #endregion
} }

View File

@@ -24,17 +24,17 @@ import javax.annotation.Nonnull;
* 断言工具 * 断言工具
* *
* <p> * <p>
* 本工具类基本仅对表达式进行判断,并在表达式为 {@code false} 时抛出对应异常 * 本工具类不封装过多判断逻辑,鼓励充分使用项目中的工具类进行逻辑判断
* 不封装过多判断逻辑,鼓励充分使用项目中的工具类进行逻辑判断。
* </p> * </p>
* *
* <pre> * <pre>
* AssertTools.checkArgument(StringUtils.hasText(str), "The argument cannot be blank."); * AssertTools.checkArgument(StringUtils.hasText(str), "The argument cannot be blank.");
* AssertTools.checkState(ArrayUtils.isNotEmpty(result), "The result cannot be empty."); * AssertTools.checkState(ArrayUtils.isNotEmpty(result), "The result cannot be empty.");
* AssertTools.checkCondition(!CollectionUtils.isEmpty(roles), () -> new InvalidInputException("The roles cannot be empty.")); * AssertTools.checkCondition(!CollectionUtils.isEmpty(roles), () -> new InvalidInputException("The roles cannot be empty."));
* AssertTools.checkCondition(RegexTools.matches(email, PatternConsts.EMAIL), "must be a well-formed email address");
* </pre> * </pre>
* *
* @author ZhouXY * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/ */
public class AssertTools { public class AssertTools {

View File

@@ -21,9 +21,9 @@ import javax.annotation.Nullable;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
public class BigDecimals { import xyz.zhouxy.plusone.commons.annotation.StaticFactoryMethod;
public static final BigDecimal ZERO = new BigDecimal("0.00"); public class BigDecimals {
public static boolean equalsValue(@Nullable BigDecimal a, @Nullable BigDecimal b) { public static boolean equalsValue(@Nullable BigDecimal a, @Nullable BigDecimal b) {
return (a == b) || (a != null && a.compareTo(b) == 0); return (a == b) || (a != null && a.compareTo(b) == 0);
@@ -49,8 +49,9 @@ public class BigDecimals {
return lt(a, b) || equalsValue(a, b); return lt(a, b) || equalsValue(a, b);
} }
@StaticFactoryMethod(BigDecimal.class)
public static BigDecimal of(final String val) { public static BigDecimal of(final String val) {
return (StringTools.isNotBlank(val)) ? new BigDecimal(val) : ZERO; return (StringTools.isNotBlank(val)) ? new BigDecimal(val) : BigDecimal.ZERO;
} }
private BigDecimals() { private BigDecimals() {

View File

@@ -32,7 +32,7 @@ import xyz.zhouxy.plusone.commons.collection.SafeConcurrentHashMap;
* *
* <p> * <p>
* <b>NOTE: 方法来自Dubboissues#2349</b> * <b>NOTE: 方法来自Dubboissues#2349</b>
* *
* @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a> * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
* @since 1.0 * @since 1.0
* @see ConcurrentHashMap * @see ConcurrentHashMap

View File

@@ -40,8 +40,8 @@ import xyz.zhouxy.plusone.commons.time.YearQuarter;
/** /**
* 日期时间工具类 * 日期时间工具类
* *
* @author zhouxy * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
*/ */
public class DateTimeTools { public class DateTimeTools {
@@ -59,7 +59,7 @@ public class DateTimeTools {
/** /**
* 获取时间格式化器 * 获取时间格式化器
* *
* @param pattern 时间格式 * @param pattern 时间格式
* @return 时间格式化器 * @return 时间格式化器
*/ */
@@ -69,7 +69,7 @@ public class DateTimeTools {
/** /**
* 将日期时间转换为指定格式的字符串 * 将日期时间转换为指定格式的字符串
* *
* @param pattern 时间格式 * @param pattern 时间格式
* @param dateTime 日期时间 * @param dateTime 日期时间
* @return 格式化的字符串 * @return 格式化的字符串
@@ -80,7 +80,7 @@ public class DateTimeTools {
/** /**
* 将时间戳转换为指定格式的字符串,使用系统默认时区 * 将时间戳转换为指定格式的字符串,使用系统默认时区
* *
* @param pattern 时间格式 * @param pattern 时间格式
* @param instant 时间戳 * @param instant 时间戳
* @return 格式化的字符串 * @return 格式化的字符串
@@ -92,7 +92,7 @@ public class DateTimeTools {
/** /**
* 将时间戳转换为指定格式的字符串,使用指定时区 * 将时间戳转换为指定格式的字符串,使用指定时区
* *
* @param pattern 时间格式 * @param pattern 时间格式
* @param instant 时间戳 * @param instant 时间戳
* @param zone 时区 * @param zone 时区
@@ -105,7 +105,7 @@ public class DateTimeTools {
/** /**
* 指定格式,返回当前时间戳对应的字符串 * 指定格式,返回当前时间戳对应的字符串
* *
* @param pattern 时间格式 * @param pattern 时间格式
* @return 格式化的字符串 * @return 格式化的字符串
*/ */
@@ -115,7 +115,7 @@ public class DateTimeTools {
/** /**
* 指定格式,返回当前时间戳对应的字符串,使用指定时区 * 指定格式,返回当前时间戳对应的字符串,使用指定时区
* *
* @param pattern 时间格式 * @param pattern 时间格式
* @param zone 时区 * @param zone 时区
* @return 格式化的字符串 * @return 格式化的字符串
@@ -128,7 +128,7 @@ public class DateTimeTools {
/** /**
* 将时间戳转换为 {@link Date} 对象 * 将时间戳转换为 {@link Date} 对象
* *
* @param timeMillis 时间戳 * @param timeMillis 时间戳
* @return {@link Date} 对象 * @return {@link Date} 对象
*/ */
@@ -138,7 +138,7 @@ public class DateTimeTools {
/** /**
* 将 {@link Calendar} 对象转换为 {@link Date} 对象 * 将 {@link Calendar} 对象转换为 {@link Date} 对象
* *
* @param calendar {@link Calendar} 对象 * @param calendar {@link Calendar} 对象
* @return {@link Date} 对象 * @return {@link Date} 对象
*/ */
@@ -148,7 +148,7 @@ public class DateTimeTools {
/** /**
* 将 {@link Instant} 对象转换为 {@link Date} 对象 * 将 {@link Instant} 对象转换为 {@link Date} 对象
* *
* @param instant {@link Instant} 对象 * @param instant {@link Instant} 对象
* @return {@link Date} 对象 * @return {@link Date} 对象
*/ */
@@ -158,7 +158,7 @@ public class DateTimeTools {
/** /**
* 将 {@link ZonedDateTime} 对象转换为 {@link Date} 对象 * 将 {@link ZonedDateTime} 对象转换为 {@link Date} 对象
* *
* @param zonedDateTime {@link ZonedDateTime} 对象 * @param zonedDateTime {@link ZonedDateTime} 对象
* @return {@link Date} 对象 * @return {@link Date} 对象
*/ */
@@ -168,7 +168,7 @@ public class DateTimeTools {
/** /**
* 使用指定时区,将 {@link LocalDateTime} 对象转换为 {@link Date} 对象 * 使用指定时区,将 {@link LocalDateTime} 对象转换为 {@link Date} 对象
* *
* @param localDateTime {@link LocalDateTime} 对象 * @param localDateTime {@link LocalDateTime} 对象
* @param zone 时区 * @param zone 时区
* @return {@link Date} 对象 * @return {@link Date} 对象
@@ -179,7 +179,7 @@ public class DateTimeTools {
/** /**
* 使用指定时区,将 {@link LocalDate} 和 {@link LocalTime} 对象转换为 {@link Date} 对象 * 使用指定时区,将 {@link LocalDate} 和 {@link LocalTime} 对象转换为 {@link Date} 对象
* *
* @param localDate {@link LocalDate} 对象 * @param localDate {@link LocalDate} 对象
* @param localTime {@link LocalTime} 对象 * @param localTime {@link LocalTime} 对象
* @param zone 时区 * @param zone 时区
@@ -193,7 +193,7 @@ public class DateTimeTools {
/** /**
* 将时间戳转换为 {@link Instant} 对象 * 将时间戳转换为 {@link Instant} 对象
* *
* @param timeMillis 时间戳 * @param timeMillis 时间戳
* @return {@link Instant} 对象 * @return {@link Instant} 对象
*/ */
@@ -203,7 +203,7 @@ public class DateTimeTools {
/** /**
* 将 {@link Date} 对象转换为 {@link Instant} 对象 * 将 {@link Date} 对象转换为 {@link Instant} 对象
* *
* @param date {@link Date} 对象 * @param date {@link Date} 对象
* @return {@link Instant} 对象 * @return {@link Instant} 对象
*/ */
@@ -213,7 +213,7 @@ public class DateTimeTools {
/** /**
* 将 {@link Calendar} 对象转换为 {@link Instant} 对象 * 将 {@link Calendar} 对象转换为 {@link Instant} 对象
* *
* @param calendar {@link Calendar} 对象 * @param calendar {@link Calendar} 对象
* @return {@link Instant} 对象 * @return {@link Instant} 对象
*/ */
@@ -223,7 +223,7 @@ public class DateTimeTools {
/** /**
* 将 {@link ZonedDateTime} 对象转换为 {@link Instant} 对象 * 将 {@link ZonedDateTime} 对象转换为 {@link Instant} 对象
* *
* @param zonedDateTime {@link ZonedDateTime} 对象 * @param zonedDateTime {@link ZonedDateTime} 对象
* @return {@link Instant} 对象 * @return {@link Instant} 对象
* @deprecated 请使用 {@link ZonedDateTime#toInstant()} 方法 * @deprecated 请使用 {@link ZonedDateTime#toInstant()} 方法
@@ -235,7 +235,7 @@ public class DateTimeTools {
/** /**
* 使用指定时区,将 {@link LocalDateTime} 对象转换为 {@link Instant} 对象 * 使用指定时区,将 {@link LocalDateTime} 对象转换为 {@link Instant} 对象
* *
* @param LocalDateTime {@link LocalDateTime} 对象 * @param LocalDateTime {@link LocalDateTime} 对象
* @param zone 时区 * @param zone 时区
* @return {@link Instant} 对象 * @return {@link Instant} 对象
@@ -252,7 +252,7 @@ public class DateTimeTools {
* 传入不同 {@link ZoneId},获取到的 {@link ZonedDateTime} 对象实际上还是同一时间戳, * 传入不同 {@link ZoneId},获取到的 {@link ZonedDateTime} 对象实际上还是同一时间戳,
* 只是不同时区的表示。 * 只是不同时区的表示。
* </p> * </p>
* *
* @param timeMillis 时间戳 * @param timeMillis 时间戳
* @param zone 时区 * @param zone 时区
* @return 带时区信息的地区时间 * @return 带时区信息的地区时间
@@ -267,7 +267,7 @@ public class DateTimeTools {
* 传入不同 {@link ZoneId},获取到的 {@link ZonedDateTime} 对象实际上还是同一时间戳, * 传入不同 {@link ZoneId},获取到的 {@link ZonedDateTime} 对象实际上还是同一时间戳,
* 只是不同时区的表示。 * 只是不同时区的表示。
* </p> * </p>
* *
* @param dateTime {@link Date} 对象 * @param dateTime {@link Date} 对象
* @param zone 时区 * @param zone 时区
* @return 带时区信息的地区时间 * @return 带时区信息的地区时间
@@ -282,7 +282,7 @@ public class DateTimeTools {
* 传入不同 {@link ZoneId},获取到的 {@link ZonedDateTime} 对象实际上表示的还是还是同一时间戳的时间, * 传入不同 {@link ZoneId},获取到的 {@link ZonedDateTime} 对象实际上表示的还是还是同一时间戳的时间,
* 只是不同时区的表示。 * 只是不同时区的表示。
* </p> * </p>
* *
* @param dateTime {@link Date} 对象 * @param dateTime {@link Date} 对象
* @param timeZone 时区 * @param timeZone 时区
* @return 带时区信息的地区时间 * @return 带时区信息的地区时间
@@ -294,7 +294,7 @@ public class DateTimeTools {
/** /**
* 使用 {@code calendar} 对象的时区信息,将 {@link Calendar} 对象转换为 {@link ZonedDateTime} * 使用 {@code calendar} 对象的时区信息,将 {@link Calendar} 对象转换为 {@link ZonedDateTime}
* 对象。 * 对象。
* *
* @param calendar{@link Calendar} 对象 * @param calendar{@link Calendar} 对象
* @return {@link ZonedDateTime} 对象 * @return {@link ZonedDateTime} 对象
*/ */
@@ -304,7 +304,7 @@ public class DateTimeTools {
/** /**
* 使用指定的时区,将 {@link Calendar} 对象转换为 {@link ZonedDateTime} 对象。 * 使用指定的时区,将 {@link Calendar} 对象转换为 {@link ZonedDateTime} 对象。
* *
* @param calendar {@link Calendar} 对象 * @param calendar {@link Calendar} 对象
* @param zone 时区 * @param zone 时区
* @return {@link ZonedDateTime} 对象 * @return {@link ZonedDateTime} 对象
@@ -315,7 +315,7 @@ public class DateTimeTools {
/** /**
* 使用指定的时区,将 {@link Calendar} 对象转换为 {@link ZonedDateTime} 对象。 * 使用指定的时区,将 {@link Calendar} 对象转换为 {@link ZonedDateTime} 对象。
* *
* @param calendar {@link Calendar} 对象 * @param calendar {@link Calendar} 对象
* @param zone 时区 * @param zone 时区
* @return {@link ZonedDateTime} 对象 * @return {@link ZonedDateTime} 对象
@@ -326,11 +326,11 @@ public class DateTimeTools {
/** /**
* 创建带时区的地区时间 * 创建带时区的地区时间
* *
* @param localDateTime 地区时间 * @param localDateTime 地区时间
* @param zone 时区 * @param zone 时区
* @return 带时区的地区时间 * @return 带时区的地区时间
* *
* @deprecated 使用 {@link ZonedDateTime#of(LocalDateTime, ZoneId)} * @deprecated 使用 {@link ZonedDateTime#of(LocalDateTime, ZoneId)}
*/ */
@Deprecated @Deprecated
@@ -342,7 +342,7 @@ public class DateTimeTools {
/** /**
* 获取时间戳在指定时区的地区时间。 * 获取时间戳在指定时区的地区时间。
* *
* @param timeMillis 时间戳 * @param timeMillis 时间戳
* @param zone 时区 * @param zone 时区
* @return 地区时间 * @return 地区时间
@@ -353,7 +353,7 @@ public class DateTimeTools {
/** /**
* 获取 {@link Date} 所表示的时间戳,在指定时区的地区时间。 * 获取 {@link Date} 所表示的时间戳,在指定时区的地区时间。
* *
* @param dateTime {@link Date} 对象 * @param dateTime {@link Date} 对象
* @param zone 时区 * @param zone 时区
* @return 地区时间 * @return 地区时间
@@ -364,7 +364,7 @@ public class DateTimeTools {
/** /**
* 获取 {@link Date} 所表示的时间戳,在指定时区的地区时间。 * 获取 {@link Date} 所表示的时间戳,在指定时区的地区时间。
* *
* @param dateTime {@link Date} 对象 * @param dateTime {@link Date} 对象
* @param timeZone 时区 * @param timeZone 时区
* @return 地区时间 * @return 地区时间
@@ -375,7 +375,7 @@ public class DateTimeTools {
/** /**
* 获取 {@link Calendar} 所表示的时间戳,在指定时区的地区时间。 * 获取 {@link Calendar} 所表示的时间戳,在指定时区的地区时间。
* *
* @param calendar {@link Calendar} 对象 * @param calendar {@link Calendar} 对象
* @param zone 时区 * @param zone 时区
* @return 地区时间 * @return 地区时间
@@ -386,7 +386,7 @@ public class DateTimeTools {
/** /**
* 获取 {@link Calendar} 所表示的时间戳,在指定时区的地区时间。 * 获取 {@link Calendar} 所表示的时间戳,在指定时区的地区时间。
* *
* @param calendar {@link Calendar} 对象 * @param calendar {@link Calendar} 对象
* @param zone 时区 * @param zone 时区
* @return 地区时间 * @return 地区时间
@@ -397,7 +397,7 @@ public class DateTimeTools {
/** /**
* 获取 {@link ZonedDateTime} 所表示的时间戳,在指定时区的地区时间。 * 获取 {@link ZonedDateTime} 所表示的时间戳,在指定时区的地区时间。
* *
* @param zonedDateTime {@link ZonedDateTime} 对象 * @param zonedDateTime {@link ZonedDateTime} 对象
* @param zone 时区 * @param zone 时区
* @return 地区时间 * @return 地区时间
@@ -412,7 +412,7 @@ public class DateTimeTools {
/** /**
* 将 {@link java.time.Instant} 转换为 {@link org.joda.time.Instant} * 将 {@link java.time.Instant} 转换为 {@link org.joda.time.Instant}
* *
* @param instant {@link java.time.Instant} 对象 * @param instant {@link java.time.Instant} 对象
* @return {@link org.joda.time.Instant} 对象 * @return {@link org.joda.time.Instant} 对象
*/ */
@@ -422,7 +422,7 @@ public class DateTimeTools {
/** /**
* 将 {@link java.time.ZonedDateTime} 转换为 {@link org.joda.time.Instant} * 将 {@link java.time.ZonedDateTime} 转换为 {@link org.joda.time.Instant}
* *
* @param zonedDateTime {@link java.time.ZonedDateTime} 对象 * @param zonedDateTime {@link java.time.ZonedDateTime} 对象
* @return {@link org.joda.time.Instant} 对象 * @return {@link org.joda.time.Instant} 对象
*/ */
@@ -432,7 +432,7 @@ public class DateTimeTools {
/** /**
* 计算指定时区的地区时间,对应的时间戳。结果为 {@link org.joda.time.Instant} 对象 * 计算指定时区的地区时间,对应的时间戳。结果为 {@link org.joda.time.Instant} 对象
* *
* @param localDateTime {@link java.time.LocalDateTime} 对象 * @param localDateTime {@link java.time.LocalDateTime} 对象
* @param zone 时区 * @param zone 时区
* @return {@link org.joda.time.Instant} 对象 * @return {@link org.joda.time.Instant} 对象
@@ -456,7 +456,7 @@ public class DateTimeTools {
/** /**
* 将 joda-time 中的 {@link org.joda.time.DateTime} 对象转换为 Java 的 * 将 joda-time 中的 {@link org.joda.time.DateTime} 对象转换为 Java 的
* {@link java.time.Instant} 对象 * {@link java.time.Instant} 对象
* *
* @param dateTime joda-time 中表示日期时间的 {@link org.joda.time.DateTime} 对象 * @param dateTime joda-time 中表示日期时间的 {@link org.joda.time.DateTime} 对象
* @return Java 表示时间戳的 {@link java.time.Instant} 对象 * @return Java 表示时间戳的 {@link java.time.Instant} 对象
*/ */
@@ -468,7 +468,7 @@ public class DateTimeTools {
* 将 joda-time 中的 {@link org.joda.time.LocalDateTime} 对象和 * 将 joda-time 中的 {@link org.joda.time.LocalDateTime} 对象和
* {@link org.joda.time.DateTimeZone} 对象 * {@link org.joda.time.DateTimeZone} 对象
* 转换为 Java 中的 {@link java.time.Instant} 对象 * 转换为 Java 中的 {@link java.time.Instant} 对象
* *
* @param localDateTime * @param localDateTime
* @param zone * @param zone
* @return * @return
@@ -484,7 +484,7 @@ public class DateTimeTools {
/** /**
* 将 Java 中表示日期时间的 {@link java.time.ZonedDateTime} 对象 * 将 Java 中表示日期时间的 {@link java.time.ZonedDateTime} 对象
* 转换为 joda-time 的 {@link org.joda.time.DateTime} 对象 * 转换为 joda-time 的 {@link org.joda.time.DateTime} 对象
* *
* @param zonedDateTime 日期时间 * @param zonedDateTime 日期时间
* @return joda-time 中对应的 {@link org.joda.time.DateTime} 对象 * @return joda-time 中对应的 {@link org.joda.time.DateTime} 对象
*/ */
@@ -498,7 +498,7 @@ public class DateTimeTools {
* {@link java.time.ZoneId} 对象转换为 joda-time 中对应的 {@link org.joda.time.DateTime} * {@link java.time.ZoneId} 对象转换为 joda-time 中对应的 {@link org.joda.time.DateTime}
* 对象 * 对象
* 转换为 joda-time 中对应的 {@link org.joda.time.DateTime} 对象 * 转换为 joda-time 中对应的 {@link org.joda.time.DateTime} 对象
* *
* @param localDateTime 日期时间 * @param localDateTime 日期时间
* @param zone 时区 * @param zone 时区
* @return joda-time 中对应的 {@link org.joda.time.DateTime} 对象 * @return joda-time 中对应的 {@link org.joda.time.DateTime} 对象
@@ -512,7 +512,7 @@ public class DateTimeTools {
/** /**
* 计算时间戳在指定时区对应的时间,结果使用 {@link org.joda.time.DateTime} 表示 * 计算时间戳在指定时区对应的时间,结果使用 {@link org.joda.time.DateTime} 表示
* *
* @param instant java.time 中的时间戳 * @param instant java.time 中的时间戳
* @param zone java.time 中的时区 * @param zone java.time 中的时区
* @return joda-time 中带时区的日期时间 * @return joda-time 中带时区的日期时间
@@ -528,7 +528,7 @@ public class DateTimeTools {
/** /**
* 将 joda-time 中带时区的日期时间,转换为 java.time 中带时区的日期时间 * 将 joda-time 中带时区的日期时间,转换为 java.time 中带时区的日期时间
* *
* @param dateTime joda-time 中带时区的日期时间 * @param dateTime joda-time 中带时区的日期时间
* @return java.time 中带时区的日期时间 * @return java.time 中带时区的日期时间
*/ */
@@ -541,7 +541,7 @@ public class DateTimeTools {
* 将 joda-time 中的 {@link org.joda.time.LocalDateTime} 和 * 将 joda-time 中的 {@link org.joda.time.LocalDateTime} 和
* {@link org.joda.time.DateTimeZone} * {@link org.joda.time.DateTimeZone}
* 转换为 java.time 中的 {@link java.time.ZonedDateTime} * 转换为 java.time 中的 {@link java.time.ZonedDateTime}
* *
* @param localDateTime joda-time 中的地区时间 * @param localDateTime joda-time 中的地区时间
* @param dateTimeZone joda-time 中的时区 * @param dateTimeZone joda-time 中的时区
* @return java.time 中带时区的日期时间 * @return java.time 中带时区的日期时间
@@ -556,7 +556,7 @@ public class DateTimeTools {
/** /**
* 获取 joda-time 中的 {@link org.joda.time.Instant} 在指定时区的时间,用 Java 8 * 获取 joda-time 中的 {@link org.joda.time.Instant} 在指定时区的时间,用 Java 8
* {@link java.time.ZonedDateTime} 表示 * {@link java.time.ZonedDateTime} 表示
* *
* @param instant joda-time 中的时间戳 * @param instant joda-time 中的时间戳
* @param dateTimeZone joda-time 中的时区 * @param dateTimeZone joda-time 中的时区
* @return * @return
@@ -572,7 +572,7 @@ public class DateTimeTools {
/** /**
* 将 {@link java.time.LocalDateTime} 转换为 {@link org.joda.time.LocalDateTime} * 将 {@link java.time.LocalDateTime} 转换为 {@link org.joda.time.LocalDateTime}
* *
* @param localDateTime Java 8 LocalDateTime * @param localDateTime Java 8 LocalDateTime
* @return joda-time LocalDateTime * @return joda-time LocalDateTime
*/ */
@@ -586,7 +586,7 @@ public class DateTimeTools {
/** /**
* 将 {@link org.joda.time.LocalDateTime} 转换为 {@link java.time.LocalDateTime} * 将 {@link org.joda.time.LocalDateTime} 转换为 {@link java.time.LocalDateTime}
* *
* @param localDateTime joda-time LocalDateTime * @param localDateTime joda-time LocalDateTime
* @return Java 8 LocalDateTime * @return Java 8 LocalDateTime
*/ */
@@ -598,7 +598,7 @@ public class DateTimeTools {
/** /**
* 转换 Java API 和 joda-time API 表示时区的对象 * 转换 Java API 和 joda-time API 表示时区的对象
* *
* @param jodaZone joda-time API 中表示时区的对象 * @param jodaZone joda-time API 中表示时区的对象
* @return Java API 中表示时区的对象 * @return Java API 中表示时区的对象
*/ */
@@ -608,7 +608,7 @@ public class DateTimeTools {
/** /**
* 转换 Java API 和 joda-time API 表示时区的对象 * 转换 Java API 和 joda-time API 表示时区的对象
* *
* @param zone Java API 中表示时区的对象 * @param zone Java API 中表示时区的对象
* @return joda-time API 中表示时区的对象 * @return joda-time API 中表示时区的对象
*/ */
@@ -620,7 +620,7 @@ public class DateTimeTools {
/** /**
* 获取指定日期所在季度 * 获取指定日期所在季度
* *
* @param date 日期 * @param date 日期
* @return 日期所在的季度 * @return 日期所在的季度
*/ */
@@ -630,7 +630,7 @@ public class DateTimeTools {
/** /**
* 获取指定日期所在季度 * 获取指定日期所在季度
* *
* @param date 日期 * @param date 日期
* @return 日期所在的季度 * @return 日期所在的季度
*/ */
@@ -640,7 +640,7 @@ public class DateTimeTools {
/** /**
* 获取指定月份所在季度 * 获取指定月份所在季度
* *
* @param month 月份 * @param month 月份
* @return 季度 * @return 季度
*/ */
@@ -650,7 +650,7 @@ public class DateTimeTools {
/** /**
* 获取指定年月所在季度 * 获取指定年月所在季度
* *
* @param year 年 * @param year 年
* @param month 月 * @param month 月
* @return 季度 * @return 季度
@@ -661,7 +661,7 @@ public class DateTimeTools {
/** /**
* 获取指定年月所在季度 * 获取指定年月所在季度
* *
* @param yearMonth 年月 * @param yearMonth 年月
* @return 季度 * @return 季度
*/ */
@@ -671,7 +671,7 @@ public class DateTimeTools {
/** /**
* 获取指定日期所在季度 * 获取指定日期所在季度
* *
* @param date 日期 * @param date 日期
* @return 日期所在的季度 * @return 日期所在的季度
*/ */

View File

@@ -134,7 +134,7 @@ public final class EnumTools {
/** /**
* 校验枚举的 ordinal。 * 校验枚举的 ordinal。
* *
* @param <E> 枚举类型 * @param <E> 枚举类型
* @param clazz 枚举类型 * @param clazz 枚举类型
* @param ordinal The ordinal * @param ordinal The ordinal
@@ -147,7 +147,7 @@ public final class EnumTools {
/** /**
* 校验枚举的 ordinal如果 ordinal 为 {@code null},则返回 {@code 0}。 * 校验枚举的 ordinal如果 ordinal 为 {@code null},则返回 {@code 0}。
* *
* @param <E> 枚举类型 * @param <E> 枚举类型
* @param clazz 枚举类型 * @param clazz 枚举类型
* @param ordinal The ordinal * @param ordinal The ordinal
@@ -160,7 +160,7 @@ public final class EnumTools {
/** /**
* 校验枚举的 ordinal如果 ordinal 为 {@code null},则返回 {@code defaultValue}。 * 校验枚举的 ordinal如果 ordinal 为 {@code null},则返回 {@code defaultValue}。
* *
* @param <E> 枚举类型 * @param <E> 枚举类型
* @param clazz 枚举类型 * @param clazz 枚举类型
* @param ordinal The ordinal * @param ordinal The ordinal

View File

@@ -46,7 +46,7 @@ public class OptionalTools {
* 包装类为 {@code null} 表示值的缺失,转为 {@link OptionalInt} 后,由 * 包装类为 {@code null} 表示值的缺失,转为 {@link OptionalInt} 后,由
* {@link OptionalInt#empty()} 表示值的缺失。 * {@link OptionalInt#empty()} 表示值的缺失。
* </p> * </p>
* *
* @param value 包装对象 * @param value 包装对象
* @return {@link OptionalInt} 实例 * @return {@link OptionalInt} 实例
*/ */
@@ -59,7 +59,7 @@ public class OptionalTools {
* <p> * <p>
* {@code Optional<Integer>} 将整数包装了两次,改为使用 {@link OptionalInt} 包装其中的整数数据。 * {@code Optional<Integer>} 将整数包装了两次,改为使用 {@link OptionalInt} 包装其中的整数数据。
* </p> * </p>
* *
* @param optionalObj {@code Optional<Integer>} 对象 * @param optionalObj {@code Optional<Integer>} 对象
* @return {@link OptionalInt} 实例 * @return {@link OptionalInt} 实例
*/ */
@@ -73,7 +73,7 @@ public class OptionalTools {
* 包装类为 {@code null} 表示值的缺失,转为 {@link OptionalLong} 后,由 * 包装类为 {@code null} 表示值的缺失,转为 {@link OptionalLong} 后,由
* {@link OptionalLong#empty()} 表示值的缺失。 * {@link OptionalLong#empty()} 表示值的缺失。
* </p> * </p>
* *
* @param value 包装对象 * @param value 包装对象
* @return {@link OptionalLong} 实例 * @return {@link OptionalLong} 实例
*/ */
@@ -86,7 +86,7 @@ public class OptionalTools {
* <p> * <p>
* {@code Optional<Long>} 将整数包装了两次,改为使用 {@link OptionalLong} 包装其中的整数数据。 * {@code Optional<Long>} 将整数包装了两次,改为使用 {@link OptionalLong} 包装其中的整数数据。
* </p> * </p>
* *
* @param optionalObj 包装对象 * @param optionalObj 包装对象
* @return {@link OptionalLong} 实例 * @return {@link OptionalLong} 实例
*/ */
@@ -100,7 +100,7 @@ public class OptionalTools {
* 包装类为 {@code null} 表示值的缺失,转为 {@link OptionalDouble} 后,由 * 包装类为 {@code null} 表示值的缺失,转为 {@link OptionalDouble} 后,由
* {@link OptionalDouble#empty()} 表示值的缺失。 * {@link OptionalDouble#empty()} 表示值的缺失。
* </p> * </p>
* *
* @param value 包装对象 * @param value 包装对象
* @return {@link OptionalDouble} 实例 * @return {@link OptionalDouble} 实例
*/ */
@@ -113,7 +113,7 @@ public class OptionalTools {
* <p> * <p>
* {@code Optional<Double>} 将整数包装了两次,改为使用 {@link OptionalDouble} 包装其中的整数数据。 * {@code Optional<Double>} 将整数包装了两次,改为使用 {@link OptionalDouble} 包装其中的整数数据。
* </p> * </p>
* *
* @param optionalObj 包装对象 * @param optionalObj 包装对象
* @return {@link OptionalDouble} 实例 * @return {@link OptionalDouble} 实例
*/ */
@@ -124,7 +124,7 @@ public class OptionalTools {
/** /**
* return the value of the optional object if present, * return the value of the optional object if present,
* otherwise {@code null}. * otherwise {@code null}.
* *
* @param <T> the class of the value * @param <T> the class of the value
* @param optionalObj {@link Optional} object, which must be non-null. * @param optionalObj {@link Optional} object, which must be non-null.
* @return the value of the optional object if present, otherwise {@code null}. * @return the value of the optional object if present, otherwise {@code null}.

View File

@@ -19,6 +19,7 @@ package xyz.zhouxy.plusone.commons.util;
import java.util.Arrays; import java.util.Arrays;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@@ -27,12 +28,10 @@ import javax.annotation.Nullable;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import xyz.zhouxy.plusone.commons.collection.SafeConcurrentHashMap;
/** /**
* 封装一些常用的正则操作,并可以缓存 {@link Pattern} 实例以复用(最多缓存大概 256 个)。 * 封装一些常用的正则操作,并可以缓存 {@link Pattern} 实例以复用(最多缓存大概 256 个)。
* *
* @author ZhouXY * @author <a href="http://zhouxy.xyz:3000/ZhouXY108">ZhouXY</a>
* *
*/ */
public final class RegexTools { public final class RegexTools {
@@ -40,11 +39,11 @@ public final class RegexTools {
private static final int DEFAULT_CACHE_INITIAL_CAPACITY = 64; private static final int DEFAULT_CACHE_INITIAL_CAPACITY = 64;
private static final int MAX_CACHE_SIZE = 256; private static final int MAX_CACHE_SIZE = 256;
private static final Map<String, Pattern> PATTERN_CACHE private static final Map<String, Pattern> PATTERN_CACHE
= new SafeConcurrentHashMap<>(DEFAULT_CACHE_INITIAL_CAPACITY); = new ConcurrentHashMap<>(DEFAULT_CACHE_INITIAL_CAPACITY);
/** /**
* 获取 {@link Pattern} 实例。 * 获取 {@link Pattern} 实例。
* *
* @param pattern 正则表达式 * @param pattern 正则表达式
* @param cachePattern 是否缓存 {@link Pattern} 实例 * @param cachePattern 是否缓存 {@link Pattern} 实例
* @return {@link Pattern} 实例 * @return {@link Pattern} 实例
@@ -56,7 +55,7 @@ public final class RegexTools {
/** /**
* 获取 {@link Pattern} 实例,不缓存。 * 获取 {@link Pattern} 实例,不缓存。
* *
* @param pattern 正则表达式 * @param pattern 正则表达式
* @return {@link Pattern} 实例 * @return {@link Pattern} 实例
*/ */
@@ -67,7 +66,7 @@ public final class RegexTools {
/** /**
* 将各个正则表达式转为 {@link Pattern} 实例。 * 将各个正则表达式转为 {@link Pattern} 实例。
* *
* @param patterns 正则表达式 * @param patterns 正则表达式
* @param cachePattern 是否缓存 {@link Pattern} 实例 * @param cachePattern 是否缓存 {@link Pattern} 实例
* @return {@link Pattern} 实例数组 * @return {@link Pattern} 实例数组
@@ -82,7 +81,7 @@ public final class RegexTools {
/** /**
* 将各个正则表达式转为 {@link Pattern} 实例,不缓存。 * 将各个正则表达式转为 {@link Pattern} 实例,不缓存。
* *
* @param patterns 正则表达式 * @param patterns 正则表达式
* @return {@link Pattern} 实例数组 * @return {@link Pattern} 实例数组
*/ */
@@ -94,7 +93,7 @@ public final class RegexTools {
/** /**
* 手动缓存 Pattern 实例。 * 手动缓存 Pattern 实例。
* *
* @param pattern 要缓存的 {@link Pattern} 实例 * @param pattern 要缓存的 {@link Pattern} 实例
* @return 缓存的 Pattern 实例。如果缓存已满,则返回 {@code null}。 * @return 缓存的 Pattern 实例。如果缓存已满,则返回 {@code null}。
*/ */
@@ -110,7 +109,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配 {@code pattern}。 * 判断 {@code input} 是否匹配 {@code pattern}。
* *
* @param input 输入 * @param input 输入
* @param pattern 正则 * @param pattern 正则
* @return 判断结果 * @return 判断结果
@@ -122,7 +121,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配 {@code patterns} 中的一个。 * 判断 {@code input} 是否匹配 {@code patterns} 中的一个。
* *
* @param input 输入 * @param input 输入
* @param patterns 正则 * @param patterns 正则
* @return 判断结果 * @return 判断结果
@@ -135,7 +134,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配全部正则。 * 判断 {@code input} 是否匹配全部正则。
* *
* @param input 输入 * @param input 输入
* @param patterns 正则 * @param patterns 正则
* @return 判断结果 * @return 判断结果
@@ -148,7 +147,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配 {@code pattern}。 * 判断 {@code input} 是否匹配 {@code pattern}。
* *
* @param input 输入 * @param input 输入
* @param pattern 正则表达式 * @param pattern 正则表达式
* @param cachePattern 是否缓存 {@link Pattern} 实例 * @param cachePattern 是否缓存 {@link Pattern} 实例
@@ -165,7 +164,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配 {@code pattern}。不缓存 {@link Pattern} 实例。 * 判断 {@code input} 是否匹配 {@code pattern}。不缓存 {@link Pattern} 实例。
* *
* @param input 输入 * @param input 输入
* @param pattern 正则表达式 * @param pattern 正则表达式
* @return 判断结果 * @return 判断结果
@@ -177,7 +176,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配 {@code patterns} 中的一个。 * 判断 {@code input} 是否匹配 {@code patterns} 中的一个。
* *
* @param input 输入 * @param input 输入
* @param patterns 正则表达式 * @param patterns 正则表达式
* @param cachePattern 是否缓存 {@link Pattern} 实例 * @param cachePattern 是否缓存 {@link Pattern} 实例
@@ -195,7 +194,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配 {@code patterns} 中的一个。不缓存 {@link Pattern} 实例。 * 判断 {@code input} 是否匹配 {@code patterns} 中的一个。不缓存 {@link Pattern} 实例。
* *
* @param input 输入 * @param input 输入
* @param patterns 正则表达式 * @param patterns 正则表达式
* @return 判断结果 * @return 判断结果
@@ -209,7 +208,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配全部正则。 * 判断 {@code input} 是否匹配全部正则。
* *
* @param input 输入 * @param input 输入
* @param patterns 正则表达式 * @param patterns 正则表达式
* @param cachePattern 是否缓存 {@link Pattern} 实例 * @param cachePattern 是否缓存 {@link Pattern} 实例
@@ -227,7 +226,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配全部正则。不缓存 {@link Pattern} 实例。 * 判断 {@code input} 是否匹配全部正则。不缓存 {@link Pattern} 实例。
* *
* @param input 输入 * @param input 输入
* @param patterns 正则表达式 * @param patterns 正则表达式
* @return 判断结果 * @return 判断结果
@@ -241,7 +240,7 @@ public final class RegexTools {
/** /**
* 生成 Matcher。 * 生成 Matcher。
* *
* @param input 输入 * @param input 输入
* @param pattern 正则 * @param pattern 正则
* @return 结果 * @return 结果
@@ -254,7 +253,7 @@ public final class RegexTools {
/** /**
* 生成 Matcher。 * 生成 Matcher。
* *
* @param input 输入 * @param input 输入
* @param pattern 正则表达式 * @param pattern 正则表达式
* @param cachePattern 是否缓存 {@link Pattern} 实例 * @param cachePattern 是否缓存 {@link Pattern} 实例
@@ -271,7 +270,7 @@ public final class RegexTools {
/** /**
* 生成 Matcher。不缓存 {@link Pattern} 实例。 * 生成 Matcher。不缓存 {@link Pattern} 实例。
* *
* @param input 输入 * @param input 输入
* @param pattern 正则表达式 * @param pattern 正则表达式
* @return 结果 * @return 结果
@@ -286,7 +285,7 @@ public final class RegexTools {
/** /**
* 获取 {@link Pattern} 实例。 * 获取 {@link Pattern} 实例。
* *
* @param pattern 正则表达式 * @param pattern 正则表达式
* @param cachePattern 是否缓存 {@link Pattern} 实例 * @param cachePattern 是否缓存 {@link Pattern} 实例
* @return {@link Pattern} 实例 * @return {@link Pattern} 实例
@@ -305,7 +304,7 @@ public final class RegexTools {
/** /**
* 获取 {@link Pattern} 实例,不缓存。 * 获取 {@link Pattern} 实例,不缓存。
* *
* @param pattern 正则表达式 * @param pattern 正则表达式
* @return {@link Pattern} 实例 * @return {@link Pattern} 实例
*/ */
@@ -320,7 +319,7 @@ public final class RegexTools {
/** /**
* 将各个正则表达式转为 {@link Pattern} 实例。 * 将各个正则表达式转为 {@link Pattern} 实例。
* *
* @param patterns 正则表达式 * @param patterns 正则表达式
* @return {@link Pattern} 实例数组 * @return {@link Pattern} 实例数组
*/ */
@@ -333,7 +332,7 @@ public final class RegexTools {
/** /**
* 将各个正则表达式转为 {@link Pattern} 实例。 * 将各个正则表达式转为 {@link Pattern} 实例。
* *
* @param patterns 正则表达式 * @param patterns 正则表达式
* @return {@link Pattern} 实例数组 * @return {@link Pattern} 实例数组
*/ */
@@ -346,7 +345,7 @@ public final class RegexTools {
/** /**
* 判断 {@code input} 是否匹配 {@code pattern}。 * 判断 {@code input} 是否匹配 {@code pattern}。
* *
* @param input 输入 * @param input 输入
* @param pattern 正则 * @param pattern 正则
* @return 判断结果 * @return 判断结果

View File

@@ -59,7 +59,7 @@ public class TreeBuilder<T, TSubTree extends T, TIdentity> {
* <p> * <p>
* <b>注意,该方法会直接操作 nodes 列表中的节点,并没有做深拷贝, * <b>注意,该方法会直接操作 nodes 列表中的节点,并没有做深拷贝,
* 注意避免 nodes 中的元素产生变化所带来的意料之外的影响。</b> * 注意避免 nodes 中的元素产生变化所带来的意料之外的影响。</b>
* *
* @param nodes 平铺的节点列表 * @param nodes 平铺的节点列表
*/ */
public List<T> buildTree(Collection<T> nodes) { public List<T> buildTree(Collection<T> nodes) {
@@ -72,7 +72,7 @@ public class TreeBuilder<T, TSubTree extends T, TIdentity> {
* <p> * <p>
* <b>!!注意:该方法会直接操作 nodes 列表中的节点,并没有做深拷贝, * <b>!!注意:该方法会直接操作 nodes 列表中的节点,并没有做深拷贝,
* 注意避免 nodes 中的元素产生变化所带来的意料之外的影响。</b> * 注意避免 nodes 中的元素产生变化所带来的意料之外的影响。</b>
* *
* @param nodes 平铺的节点列表 * @param nodes 平铺的节点列表
* @param comparator 用于节点的排序。 * @param comparator 用于节点的排序。
* 若为 {@code null},则使用 {@link #defaultComparator} * 若为 {@code null},则使用 {@link #defaultComparator}
@@ -90,7 +90,7 @@ public class TreeBuilder<T, TSubTree extends T, TIdentity> {
* <p> * <p>
* <b>注意,该方法会直接操作 nodes 列表中的节点,并没有做深拷贝, * <b>注意,该方法会直接操作 nodes 列表中的节点,并没有做深拷贝,
* 注意避免 nodes 中的元素产生变化所带来的意料之外的影响。</b> * 注意避免 nodes 中的元素产生变化所带来的意料之外的影响。</b>
* *
* @param nodes 平铺的节点列表 * @param nodes 平铺的节点列表
* @param comparator 用于节点的排序。若为 {@code null},则不排序 * @param comparator 用于节点的排序。若为 {@code null},则不排序
*/ */