fix comment

This commit is contained in:
Looly 2025-06-27 11:16:37 +08:00
parent c424d76f88
commit 9cc095463e
11 changed files with 186 additions and 45 deletions

View File

@ -16,5 +16,5 @@
# limitations under the License.
#
export JAVA_HOME="/cygdrive/d/java/jdk-17.0.11"
export JAVA_HOME="/cygdrive/d/java/jdk-17.0.15"
export PATH="$JAVA_HOME/bin:$PATH"

View File

@ -19,6 +19,7 @@ package cn.hutool.v7.core.data.id;
import cn.hutool.v7.core.lang.generator.Generator;
import cn.hutool.v7.core.text.StrUtil;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;
@ -41,27 +42,41 @@ import java.util.concurrent.atomic.AtomicLong;
* @author funkyeselfishlover
*/
public class SeataSnowflake implements Generator<Long>, Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 默认的起始时间为2020-05-03
*/
public static final long DEFAULT_TWEPOCH = 1588435200000L;
// 节点ID长度
/**
* 节点ID长度
*/
private static final int NODE_ID_BITS = 10;
/**
* 节点ID的最大值1023
*/
protected static final int MAX_NODE_ID = ~(-1 << NODE_ID_BITS);
// 时间戳长度
/**
* 时间戳长度
*/
private static final int TIMESTAMP_BITS = 41;
// 序列号12位表示只允许序号的范围为0-4095
/**
* 序列号12位表示只允许序号的范围为0-4095
*/
private static final int SEQUENCE_BITS = 12;
// 时间戳+序号的最大值
/**
* // 时间戳+序号的最大值
*/
private static final long timestampAndSequenceMask = ~(-1L << (TIMESTAMP_BITS + SEQUENCE_BITS));
/**
* 节点ID
*/
private long nodeId;
/**
* 时间戳+序号
*/
private final AtomicLong timestampAndSequence;
/**

View File

@ -22,6 +22,7 @@ import cn.hutool.v7.core.lang.generator.Generator;
import cn.hutool.v7.core.lang.tuple.Pair;
import cn.hutool.v7.core.util.RandomUtil;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
@ -50,39 +51,65 @@ import java.util.Date;
* @since 3.0.1
*/
public class Snowflake implements Generator<Long>, Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 默认的起始时间为Thu, 04 Nov 2010 01:42:54 GMT
*/
public static final long DEFAULT_TWEPOCH = 1288834974657L;
/**
* 机器ID位数
*/
private static final long WORKER_ID_BITS = 5L;
/**
* 最大支持机器节点数0~31一共32个
*/
protected static final long MAX_WORKER_ID = ~(-1L << WORKER_ID_BITS);
/**
* 数据中心ID位数
*/
private static final long DATA_CENTER_ID_BITS = 5L;
/**
* 最大支持数据中心节点数0~31一共32个
*/
protected static final long MAX_DATA_CENTER_ID = ~(-1L << DATA_CENTER_ID_BITS);
// 序列号12位表示只允许序号的范围为0-4095
/**
* 序列号12位表示只允许序号的范围为0-4095
*/
private static final long SEQUENCE_BITS = 12L;
// 机器节点左移12位
/**
* 机器节点左移12位
*/
private static final long WORKER_ID_SHIFT = SEQUENCE_BITS;
// 数据中心节点左移17位
/**
* 数据中心节点左移17位
*/
private static final long DATA_CENTER_ID_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS;
// 时间毫秒数左移22位
/**
* 时间毫秒数左移22位
*/
private static final long TIMESTAMP_LEFT_SHIFT = SEQUENCE_BITS + WORKER_ID_BITS + DATA_CENTER_ID_BITS;
// 序列掩码用于限定序列最大值不能超过4095
/**
* 序列掩码用于限定序列最大值不能超过4095
*/
private static final long SEQUENCE_MASK = ~(-1L << SEQUENCE_BITS);// 4095
/**
* 初始化时间点
*/
private final long twepoch;
/**
* 工作节点ID
*/
private final long workerId;
/**
* 数据中心ID
*/
private final long dataCenterId;
/**
* 是否使用{@link SystemClock} 获取当前
*/
private final boolean useSystemClock;
/**
* 当在低频模式下时序号始终为0导致生成ID始终为偶数<br>
@ -96,6 +123,9 @@ public class Snowflake implements Generator<Long>, Serializable {
* 自增序号当高频模式下时同一毫秒内生成N个ID则这个序号在同一毫秒下自增以避免ID重复
*/
private long sequence = 0L;
/**
* 上次生成ID的时间戳
*/
private long lastTimestamp = -1L;
/**

View File

@ -24,10 +24,7 @@ import cn.hutool.v7.core.lang.Assert;
import cn.hutool.v7.core.util.CharsetUtil;
import cn.hutool.v7.core.util.ObjUtil;
import java.io.File;
import java.io.Reader;
import java.io.Serializable;
import java.io.StringReader;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.util.ArrayList;
@ -42,13 +39,16 @@ import java.util.Objects;
* @since 5.0.4
*/
public class CsvBaseReader implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 默认编码
*/
protected static final Charset DEFAULT_CHARSET = CharsetUtil.UTF_8;
/**
* 读取配置
*/
private final CsvReadConfig config;
//--------------------------------------------------------------------------------------------- Constructor start

View File

@ -18,6 +18,7 @@ package cn.hutool.v7.poi.csv;
import cn.hutool.v7.core.collection.ListUtil;
import java.io.Serial;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
@ -28,9 +29,16 @@ import java.util.List;
* @author Looly
*/
public class CsvData implements Iterable<CsvRow>, Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 头信息
*/
private final List<String> header;
/**
* 行数据
*/
private final List<CsvRow> rows;
/**

View File

@ -24,10 +24,7 @@ import cn.hutool.v7.core.text.StrTrimer;
import cn.hutool.v7.core.text.StrUtil;
import cn.hutool.v7.core.util.ObjUtil;
import java.io.Closeable;
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.*;
import java.util.*;
/**
@ -36,11 +33,18 @@ import java.util.*;
* @author Looly
*/
public final class CsvParser extends ComputeIter<CsvRow> implements Closeable, Serializable {
@Serial
private static final long serialVersionUID = 1L;
private static final int DEFAULT_ROW_CAPACITY = 10;
/**
* 读取配置
*/
private final CsvReadConfig config;
/**
* Tokener
*/
private final CsvTokener tokener;
/**
* 前一个特殊分界字符

View File

@ -25,6 +25,7 @@ import cn.hutool.v7.core.io.file.PathUtil;
import java.io.Closeable;
import java.io.File;
import java.io.Reader;
import java.io.Serial;
import java.nio.charset.Charset;
import java.nio.file.Path;
import java.util.Iterator;
@ -38,8 +39,12 @@ import java.util.stream.StreamSupport;
* @since 4.0.1
*/
public class CsvReader extends CsvBaseReader implements Iterable<CsvRow>, Closeable {
@Serial
private static final long serialVersionUID = 1L;
/**
* {@link Reader}
*/
private final Reader reader;
//--------------------------------------------------------------------------------------------- Constructor start

View File

@ -19,6 +19,7 @@ package cn.hutool.v7.poi.excel;
import org.apache.poi.ss.usermodel.CellStyle;
import cn.hutool.v7.core.collection.CollUtil;
import java.io.Serial;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
@ -32,6 +33,7 @@ import java.util.List;
* @since 6.0.0
*/
public class RowGroup implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
@ -44,8 +46,17 @@ public class RowGroup implements Serializable {
return new RowGroup(name);
}
/**
* 分组名称
*/
private String name;
/**
* 样式
*/
private CellStyle style;
/**
* 子分组
*/
private List<RowGroup> children;
/**

View File

@ -45,44 +45,78 @@ public class SheetDataSaxHandler extends DefaultHandler {
* 行处理器
*/
protected RowHandler rowHandler;
// 配置项是否对齐数据即在行尾补充null cell
/**
*/
private final boolean padCellAtEndOfRow;
// 单元格的格式表对应style.xml
/**
* 单元格的格式表对应style.xml
*/
protected StylesTable stylesTable;
// excel 2007 的共享字符串表,对应sharedString.xml
/**
* excel 2007 的共享字符串表,对应sharedString.xml
*/
protected SharedStrings sharedStrings;
// sheet的索引从0开始
/**
* sheet索引从0开始
*/
protected int sheetIndex;
// 当前非空行
/**
* 当前非空行索引从0开始
*/
protected int index;
// 当前列
/**
* 当前列坐标
*/
private int curCell;
// 单元数据类型
/**
* 单元格数据类型
*/
private CellDataType cellDataType;
// 当前行号从0开始
/**
* 当前行号从0开始
*/
private long rowNumber;
// 当前列坐标 如A1B5
/**
* 当前列坐标 如A1B5
*/
private String curCoordinate;
// 当前节点名称
/**
* 当前节点名称
*/
private ElementName curElementName;
// 前一个列的坐标
/**
* 前一个列的坐标
*/
private String preCoordinate;
// 行的最大列坐标
/**
* 行的最大列坐标
*/
private String maxCellCoordinate;
// 单元格样式
/**
* 单元格样式
*/
private XSSFCellStyle xssfCellStyle;
// 单元格存储的格式化字符串nmtFmt的formatCode属性的值
/**
* 单元格存储的格式化字符串nmtFmt的formatCode属性的值
*/
private String numFmtString;
// 是否处于sheetData标签内sax只解析此标签内的内容其它标签忽略
/**
* 是否处于sheetData标签内sax只解析此标签内的内容其它标签忽略
*/
private boolean isInSheetData;
// 上一次的内容
/**
* 上一次的内容
*/
private final StringBuilder lastContent = new StringBuilder();
// 上一次的内容
/**
* 上一次的公式
*/
private final StringBuilder lastFormula = new StringBuilder();
// 存储每行的列元素
/**
* 存储每行的列元素
*/
private List<Object> rowCellList = new ArrayList<>();
/**

View File

@ -16,11 +16,12 @@
package cn.hutool.v7.poi.excel.style;
import cn.hutool.v7.core.util.ObjUtil;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.IndexedColors;
import cn.hutool.v7.core.util.ObjUtil;
import java.io.Serial;
import java.io.Serializable;
/**
@ -30,6 +31,7 @@ import java.io.Serializable;
* @since 6.0.0
*/
public class CellBorderStyle implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
@ -69,15 +71,47 @@ public class CellBorderStyle implements Serializable {
.setLeftColor(colorIndex.getIndex());
}
/**
* 顶部边框样式定义如细线粗线虚线等
*/
private BorderStyle topStyle;
/**
* 顶部边框颜色索引值用于指定颜色主题或调色板中的颜色
*/
private Short topColor;
/**
* 右侧边框样式定义如细线粗线虚线等
*/
private BorderStyle rightStyle;
/**
* 右侧边框颜色索引值用于指定颜色主题或调色板中的颜色
*/
private Short rightColor;
/**
* 底部边框样式定义如细线粗线虚线等
*/
private BorderStyle bottomStyle;
/**
* 底部边框颜色索引值用于指定颜色主题或调色板中的颜色
*/
private Short bottomColor;
/**
* 左侧边框样式定义如细线粗线虚线等
*/
private BorderStyle leftStyle;
/**
* 左侧边框颜色索引值用于指定颜色主题或调色板中的颜色
*/
private Short leftColor;
/**
* 获取上边框的样式
*

View File

@ -27,11 +27,7 @@ import org.ofdrw.layout.element.Img;
import org.ofdrw.layout.element.Paragraph;
import org.ofdrw.reader.OFDReader;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.Serializable;
import java.io.*;
import java.nio.file.Path;
/**
@ -41,8 +37,12 @@ import java.nio.file.Path;
* @since 5.5.3
*/
public class OfdWriter implements Serializable, Closeable {
@Serial
private static final long serialVersionUID = 1L;
/**
* OFD文档
*/
private final OFDDoc doc;
/**