mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 13:34:09 +08:00
fix commenty
This commit is contained in:
parent
6fda8f0244
commit
2b7adbef08
@ -16,6 +16,7 @@
|
||||
|
||||
package cn.hutool.v7.core.cache.impl;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Iterator;
|
||||
|
||||
@ -26,8 +27,12 @@ import java.util.Iterator;
|
||||
* @param <V> 迭代对象类型
|
||||
*/
|
||||
public class CacheValuesIterator<V> implements Iterator<V>, Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 缓存对象迭代器
|
||||
*/
|
||||
private final CacheObjIterator<?, V> cacheObjIter;
|
||||
|
||||
/**
|
||||
|
@ -24,10 +24,7 @@ import cn.hutool.v7.core.text.StrUtil;
|
||||
import cn.hutool.v7.core.array.ArrayUtil;
|
||||
import cn.hutool.v7.core.text.CharUtil;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Serializable;
|
||||
import java.io.*;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.BitSet;
|
||||
@ -52,6 +49,7 @@ import java.util.BitSet;
|
||||
* @since 5.7.16
|
||||
*/
|
||||
public class PercentCodec implements Encoder<byte[], byte[]>, Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final char DEFAULT_SIZE = 256;
|
||||
@ -185,6 +183,7 @@ public class PercentCodec implements Encoder<byte[], byte[]>, Serializable {
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public static class Builder implements cn.hutool.v7.core.lang.builder.Builder<PercentCodec> {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@ -213,8 +212,15 @@ public class PercentCodec implements Encoder<byte[], byte[]>, Serializable {
|
||||
return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码器
|
||||
*/
|
||||
private final PercentCodec codec;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
* @param codec 编码器
|
||||
*/
|
||||
private Builder(final PercentCodec codec) {
|
||||
this.codec = codec;
|
||||
}
|
||||
|
@ -45,6 +45,9 @@ public class Base16Codec implements Encoder<byte[], char[]>, Decoder<CharSequenc
|
||||
*/
|
||||
public static final Base16Codec CODEC_UPPER = new Base16Codec(false);
|
||||
|
||||
/**
|
||||
* 创建Base16编码器
|
||||
*/
|
||||
private final char[] alphabets;
|
||||
|
||||
/**
|
||||
|
@ -19,6 +19,7 @@ package cn.hutool.v7.core.collection.iter;
|
||||
import cn.hutool.v7.core.collection.ListUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
@ -41,8 +42,12 @@ import java.util.List;
|
||||
* @since 3.0.7
|
||||
*/
|
||||
public class CopiedIter<E> implements IterableIter<E>, Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 迭代器
|
||||
*/
|
||||
private final Iterator<E> listIterator;
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package cn.hutool.v7.core.collection.iter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
@ -28,8 +29,12 @@ import java.util.Iterator;
|
||||
* @since 4.1.1
|
||||
*/
|
||||
public class EnumerationIter<E> implements IterableIter<E>, Serializable{
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* {@link Enumeration}
|
||||
*/
|
||||
private final Enumeration<E> e;
|
||||
|
||||
/**
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
package cn.hutool.v7.core.collection.iter;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Iterator;
|
||||
@ -28,12 +29,14 @@ import java.util.Iterator;
|
||||
* @since 3.0.8
|
||||
*/
|
||||
public class IteratorEnumeration<E> implements Enumeration<E>, Serializable{
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* {@link Iterator}
|
||||
*/
|
||||
private final Iterator<E> iterator;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 构造
|
||||
* @param iterator {@link Iterator}对象
|
||||
|
@ -20,12 +20,7 @@ import cn.hutool.v7.core.io.IORuntimeException;
|
||||
import cn.hutool.v7.core.io.IoUtil;
|
||||
import cn.hutool.v7.core.lang.Assert;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.Serializable;
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
@ -51,8 +46,12 @@ import java.nio.charset.Charset;
|
||||
* @since 4.1.1
|
||||
*/
|
||||
public class LineIter extends ComputeIter<String> implements IterableIter<String>, Closeable, Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* {@link BufferedReader}
|
||||
*/
|
||||
private final BufferedReader bufferedReader;
|
||||
|
||||
/**
|
||||
|
@ -18,6 +18,7 @@ package cn.hutool.v7.core.collection.queue;
|
||||
|
||||
import cn.hutool.v7.core.collection.BoundedCollection;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -28,10 +29,16 @@ import java.util.*;
|
||||
* @param <E> 成员类型
|
||||
*/
|
||||
public class BoundedPriorityQueue<E> extends PriorityQueue<E> implements BoundedCollection<E> {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3794348988671694820L;
|
||||
|
||||
//容量
|
||||
/**
|
||||
* 容量
|
||||
*/
|
||||
private final int capacity;
|
||||
/**
|
||||
* 比较器
|
||||
*/
|
||||
private final Comparator<? super E> comparator;
|
||||
|
||||
/**
|
||||
|
@ -17,13 +17,9 @@
|
||||
package cn.hutool.v7.core.collection.set;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Spliterator;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Stream;
|
||||
@ -35,10 +31,17 @@ import java.util.stream.Stream;
|
||||
* @author guava
|
||||
*/
|
||||
public class SetFromMap<E> extends AbstractSet<E> implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Map<E, Boolean> m; // The backing map
|
||||
private transient Set<E> s; // Its keySet
|
||||
/**
|
||||
* The backing map
|
||||
*/
|
||||
private final Map<E, Boolean> m;
|
||||
/**
|
||||
* Its keySet
|
||||
*/
|
||||
private transient Set<E> s;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
@ -152,6 +155,14 @@ public class SetFromMap<E> extends AbstractSet<E> implements Serializable {
|
||||
return s.parallelStream();
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取对象
|
||||
*
|
||||
* @param stream 输入流
|
||||
* @throws IOException IO异常
|
||||
* @throws ClassNotFoundException 类无法找到
|
||||
*/
|
||||
@Serial
|
||||
private void readObject(final java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException {
|
||||
stream.defaultReadObject();
|
||||
s = m.keySet();
|
||||
|
@ -19,6 +19,7 @@ package cn.hutool.v7.core.collection.set;
|
||||
import cn.hutool.v7.core.map.MapBuilder;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Collection;
|
||||
@ -42,9 +43,16 @@ import java.util.function.Function;
|
||||
* @since 5.7.23
|
||||
*/
|
||||
public class UniqueKeySet<K, V> extends AbstractSet<V> implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* map
|
||||
*/
|
||||
private Map<K, V> map;
|
||||
/**
|
||||
* 唯一键生成规则函数,用于生成对象对应的唯一键
|
||||
*/
|
||||
private final Function<V, K> uniqueGenerator;
|
||||
|
||||
//region 构造
|
||||
|
@ -23,6 +23,7 @@ import cn.hutool.v7.core.reflect.TypeReference;
|
||||
import cn.hutool.v7.core.reflect.TypeUtil;
|
||||
import cn.hutool.v7.core.util.ObjUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Optional;
|
||||
@ -38,6 +39,7 @@ import java.util.Optional;
|
||||
* @author Looly
|
||||
*/
|
||||
public class CompositeConverter implements Converter, Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
@ -64,7 +66,13 @@ public class CompositeConverter implements Converter, Serializable {
|
||||
return SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册转换器
|
||||
*/
|
||||
private RegisterConverter registerConverter;
|
||||
/**
|
||||
* 特殊转换器
|
||||
*/
|
||||
private SpecialConverter specialConverter;
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@ import cn.hutool.v7.core.convert.AbstractConverter;
|
||||
import cn.hutool.v7.core.convert.Converter;
|
||||
import cn.hutool.v7.core.reflect.TypeUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@ -30,8 +31,12 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
* @since 3.0.8
|
||||
*/
|
||||
public class AtomicReferenceConverter extends AbstractConverter {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 转换器
|
||||
*/
|
||||
private final Converter converter;
|
||||
|
||||
/**
|
||||
|
@ -54,6 +54,9 @@ public class BeanConverter implements Converter, Serializable {
|
||||
*/
|
||||
public static final BeanConverter INSTANCE = new BeanConverter();
|
||||
|
||||
/**
|
||||
* 默认转换选项
|
||||
*/
|
||||
private final CopyOptions copyOptions;
|
||||
|
||||
/**
|
||||
|
@ -38,6 +38,9 @@ public class ClassConverter extends AbstractConverter implements MatcherConverte
|
||||
*/
|
||||
public static final ClassConverter INSTANCE = new ClassConverter();
|
||||
|
||||
/**
|
||||
* 是否初始化这个类(执行static块)
|
||||
*/
|
||||
private final boolean isInitialized;
|
||||
|
||||
/**
|
||||
|
@ -22,6 +22,7 @@ import cn.hutool.v7.core.lang.Assert;
|
||||
import cn.hutool.v7.core.reflect.TypeUtil;
|
||||
import cn.hutool.v7.core.text.StrUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
import java.lang.ref.WeakReference;
|
||||
@ -35,8 +36,12 @@ import java.lang.reflect.Type;
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public class ReferenceConverter extends AbstractConverter {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*/
|
||||
private final Converter rootConverter;
|
||||
|
||||
/**
|
||||
@ -55,16 +60,16 @@ public class ReferenceConverter extends AbstractConverter {
|
||||
//尝试将值转换为Reference泛型的类型
|
||||
Object targetValue = null;
|
||||
final Type paramType = TypeUtil.getTypeArgument(targetClass);
|
||||
if(!TypeUtil.isUnknown(paramType)){
|
||||
if (!TypeUtil.isUnknown(paramType)) {
|
||||
targetValue = rootConverter.convert(paramType, value);
|
||||
}
|
||||
if(null == targetValue){
|
||||
if (null == targetValue) {
|
||||
targetValue = value;
|
||||
}
|
||||
|
||||
if(targetClass == WeakReference.class){
|
||||
if (targetClass == WeakReference.class) {
|
||||
return new WeakReference(targetValue);
|
||||
}else if(targetClass == SoftReference.class){
|
||||
} else if (targetClass == SoftReference.class) {
|
||||
return new SoftReference(targetValue);
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ import cn.hutool.v7.core.convert.impl.stringer.ClobStringer;
|
||||
import cn.hutool.v7.core.map.MapUtil;
|
||||
import cn.hutool.v7.core.xml.XmlUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -34,8 +35,12 @@ import java.util.function.Function;
|
||||
* @author Looly
|
||||
*/
|
||||
public class StringConverter extends AbstractConverter {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 创建StringConverter
|
||||
*/
|
||||
private Map<Class<?>, Function<Object, String>> stringer;
|
||||
|
||||
/**
|
||||
|
@ -25,6 +25,7 @@ import cn.hutool.v7.core.text.StrUtil;
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
import java.io.Serial;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
@ -33,19 +34,24 @@ import java.util.GregorianCalendar;
|
||||
* 日期转换器
|
||||
*
|
||||
* @author Looly
|
||||
*
|
||||
*/
|
||||
public class XMLGregorianCalendarConverter extends AbstractConverter {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 日期格式化 */
|
||||
/**
|
||||
* 日期格式化
|
||||
*/
|
||||
private String format;
|
||||
/**
|
||||
* {@link DatatypeFactory}
|
||||
*/
|
||||
private final DatatypeFactory datatypeFactory;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*/
|
||||
public XMLGregorianCalendarConverter(){
|
||||
public XMLGregorianCalendarConverter() {
|
||||
try {
|
||||
datatypeFactory = DatatypeFactory.newInstance();
|
||||
} catch (final DatatypeConfigurationException e) {
|
||||
@ -73,7 +79,7 @@ public class XMLGregorianCalendarConverter extends AbstractConverter {
|
||||
|
||||
@Override
|
||||
protected XMLGregorianCalendar convertInternal(final Class<?> targetClass, final Object value) {
|
||||
if(value instanceof GregorianCalendar){
|
||||
if (value instanceof GregorianCalendar) {
|
||||
return datatypeFactory.newXMLGregorianCalendar((GregorianCalendar) value);
|
||||
}
|
||||
|
||||
@ -81,18 +87,18 @@ public class XMLGregorianCalendarConverter extends AbstractConverter {
|
||||
// Handle Date
|
||||
if (value instanceof Date) {
|
||||
gregorianCalendar.setTime((Date) value);
|
||||
} else if(value instanceof Calendar){
|
||||
} else if (value instanceof Calendar) {
|
||||
final Calendar calendar = (Calendar) value;
|
||||
gregorianCalendar.setTimeZone(calendar.getTimeZone());
|
||||
gregorianCalendar.setFirstDayOfWeek(calendar.getFirstDayOfWeek());
|
||||
gregorianCalendar.setLenient(calendar.isLenient());
|
||||
gregorianCalendar.setTimeInMillis(calendar.getTimeInMillis());
|
||||
}else if (value instanceof Long) {
|
||||
} else if (value instanceof Long) {
|
||||
gregorianCalendar.setTimeInMillis((Long) value);
|
||||
} else{
|
||||
} else {
|
||||
final String valueStr = convertToStr(value);
|
||||
final Date date = StrUtil.isBlank(format) ? DateUtil.parse(valueStr) : DateUtil.parse(valueStr, format);
|
||||
if(null == date){
|
||||
if (null == date) {
|
||||
throw new ConvertException("Unsupported date value: " + value);
|
||||
}
|
||||
gregorianCalendar.setTime(date);
|
||||
|
@ -49,7 +49,9 @@ public class MultiStrFinder {
|
||||
* 根节点
|
||||
*/
|
||||
protected final Node root;
|
||||
// 全部节点数量
|
||||
/**
|
||||
* 全部节点数量
|
||||
*/
|
||||
int nodeSize;
|
||||
|
||||
/**
|
||||
@ -188,15 +190,18 @@ public class MultiStrFinder {
|
||||
* AC 自动机节点
|
||||
*/
|
||||
protected static class Node {
|
||||
// 是否是字符串 尾节点
|
||||
/**
|
||||
* 是否是字符串 尾节点
|
||||
*/
|
||||
public boolean isEnd = false;
|
||||
|
||||
// 如果当前节点是尾节点 那么表示 匹配到的字符串 其他情况下 null
|
||||
/**
|
||||
* 如果当前节点是尾节点 那么表示 匹配到的字符串 其他情况下 null
|
||||
*/
|
||||
public String tagetString;
|
||||
|
||||
//失效节点
|
||||
/**
|
||||
* 失效节点
|
||||
*/
|
||||
public Node fail;
|
||||
|
||||
/**
|
||||
* 直接路由表
|
||||
* 减少挑 fail过程 使用数组 + charIndex 希望库减少 hash复杂度和内存空间
|
||||
@ -204,16 +209,22 @@ public class MultiStrFinder {
|
||||
* directRouter 大小为 全部字符数量
|
||||
*/
|
||||
public Node[] directRouter;
|
||||
|
||||
// 节点编号 root 为 0
|
||||
/**
|
||||
* 节点编号 root 为 0
|
||||
*/
|
||||
public int nodeIndex;
|
||||
|
||||
// 值
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
public char value;
|
||||
|
||||
// fail指针来源
|
||||
/**
|
||||
* fail指针来源
|
||||
*/
|
||||
public List<Node> failPre = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*/
|
||||
public Node() {
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,11 @@ public class HighMultiReplacerV2 extends StrReplacer {
|
||||
*/
|
||||
protected final Map<String,String> replaceMap;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
* @param replaceMap 替换的Map
|
||||
*/
|
||||
public AhoCorasickAutomaton(final Map<String,String> replaceMap){
|
||||
super(replaceMap.keySet());
|
||||
this.replaceMap = replaceMap;
|
||||
|
Loading…
Reference in New Issue
Block a user