This commit is contained in:
Looly 2022-04-28 03:20:23 +08:00
parent 17cd183722
commit 8e2c06c671
96 changed files with 175 additions and 167 deletions

View File

@ -70,4 +70,4 @@ public class TransCollection<F, T> extends AbstractCollection<T> {
public int size() { public int size() {
return fromCollection.size(); return fromCollection.size();
} }
} }

View File

@ -1,6 +1,12 @@
package cn.hutool.core.exceptions; package cn.hutool.core.exceptions;
import cn.hutool.core.lang.func.*; import cn.hutool.core.lang.func.Func;
import cn.hutool.core.lang.func.Func0;
import cn.hutool.core.lang.func.Func1;
import cn.hutool.core.lang.func.Supplier1;
import cn.hutool.core.lang.func.VoidFunc;
import cn.hutool.core.lang.func.VoidFunc0;
import cn.hutool.core.lang.func.VoidFunc1;
import java.util.Objects; import java.util.Objects;

View File

@ -98,4 +98,4 @@ public class ConsistentHash<T> implements Serializable{
//正好命中 //正好命中
return circle.get(hash); return circle.get(hash);
} }
} }

View File

@ -4,9 +4,9 @@ import cn.hutool.core.bean.BeanPath;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.getter.BasicTypeGetter;
import cn.hutool.core.lang.func.Func0; import cn.hutool.core.lang.func.Func0;
import cn.hutool.core.lang.func.LambdaUtil; import cn.hutool.core.lang.func.LambdaUtil;
import cn.hutool.core.getter.BasicTypeGetter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;

View File

@ -14,4 +14,4 @@ public interface Filter<T> {
* @return 是否接受对象 * @return 是否接受对象
*/ */
boolean accept(T t); boolean accept(T t);
} }

View File

View File

View File

View File

View File

@ -1,7 +1,7 @@
package cn.hutool.core.lang; package cn.hutool.core.lang;
import cn.hutool.core.date.SystemClock; import cn.hutool.core.date.SystemClock;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang.caller; package cn.hutool.core.lang.caller;

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang.copier; package cn.hutool.core.lang.copier;

View File

View File

View File

View File

View File

View File

View File

@ -7,4 +7,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang.func; package cn.hutool.core.lang.func;

View File

@ -1,6 +1,6 @@
package cn.hutool.core.lang.generator; package cn.hutool.core.lang.generator;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
/** /**
* UUID生成器 * UUID生成器

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang.generator; package cn.hutool.core.lang.generator;

View File

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang.hash; package cn.hutool.core.lang.hash;

View File

@ -1,13 +1,14 @@
package cn.hutool.core.util; package cn.hutool.core.lang.id;
import cn.hutool.core.exceptions.UtilException; import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.lang.ObjectId; import cn.hutool.core.lang.ObjectId;
import cn.hutool.core.lang.Singleton; import cn.hutool.core.lang.Singleton;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.lang.UUID; import cn.hutool.core.lang.id.UUID;
import cn.hutool.core.lang.id.NanoId; import cn.hutool.core.lang.id.NanoId;
import cn.hutool.core.net.NetUtil; import cn.hutool.core.net.NetUtil;
import cn.hutool.core.util.RuntimeUtil;
/** /**
* ID生成器工具类此工具类中主要封装 * ID生成器工具类此工具类中主要封装

View File

@ -15,7 +15,7 @@ import java.util.Random;
* </ul> * </ul>
* *
* <p> * <p>
* 此实现的逻辑基于JavaScript的NanoId实现https://github.com/ai/nanoid * 此实现的逻辑基于JavaScript的NanoId实现<a href="https://github.com/ai/nanoid">https://github.com/ai/nanoid</a>
* *
* @author David Klebanoff * @author David Klebanoff
*/ */

View File

@ -1,4 +1,4 @@
package cn.hutool.core.lang; package cn.hutool.core.lang.id;
import cn.hutool.core.exceptions.UtilException; import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;

View File

@ -1,4 +1,4 @@
package cn.hutool.core.lang; package cn.hutool.core.lang.id;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;

View File

View File

@ -18,4 +18,4 @@ public interface Interner<T> {
* @return 样例对象 * @return 样例对象
*/ */
T intern(T sample); T intern(T sample);
} }

View File

View File

@ -5,4 +5,4 @@
* *
* @author looly * @author looly
*/ */
package cn.hutool.core.lang.intern; package cn.hutool.core.lang.intern;

View File

@ -13,7 +13,7 @@ import java.util.function.Supplier;
* *
* @param <T> 被加载对象类型 * @param <T> 被加载对象类型
* @author Mr.Po * @author Mr.Po
* @see cn.hutool.core.lang.loader.LazyLoader * @see LazyLoader
* @since 5.6.1 * @since 5.6.1
*/ */
public class LazyFunLoader<T> extends LazyLoader<T> { public class LazyFunLoader<T> extends LazyLoader<T> {

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang.loader; package cn.hutool.core.lang.loader;

View File

@ -20,4 +20,4 @@ public interface Mutable<T> {
*/ */
void set(T value); void set(T value);
} }

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang.mutable; package cn.hutool.core.lang.mutable;

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* *
*/ */
package cn.hutool.core.lang; package cn.hutool.core.lang;

View File

@ -1,7 +1,7 @@
package cn.hutool.core.lang.reflect; package cn.hutool.core.lang.reflect;
import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.util.ReflectUtil; import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;

View File

@ -4,4 +4,4 @@
* @author looly * @author looly
* @since 5.4.2 * @since 5.4.2
*/ */
package cn.hutool.core.lang.reflect; package cn.hutool.core.lang.reflect;

View File

@ -11,4 +11,4 @@
* @author liangbaikaihttps://gitee.com/liangbaikai00/ * @author liangbaikaihttps://gitee.com/liangbaikai00/
* @since 5.2.1 * @since 5.2.1
*/ */
package cn.hutool.core.lang.tree; package cn.hutool.core.lang.tree;

View File

@ -3,7 +3,7 @@ package cn.hutool.core.util;
import cn.hutool.core.exceptions.UtilException; import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.io.IORuntimeException; import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.Pid; import cn.hutool.core.lang.id.Pid;
import cn.hutool.core.text.StrBuilder; import cn.hutool.core.text.StrBuilder;
import java.io.File; import java.io.File;

View File

@ -1,5 +1,6 @@
package cn.hutool.core.util; package cn.hutool.core.util;
import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.text.StrBuilder; import cn.hutool.core.text.StrBuilder;
import cn.hutool.core.text.StrFormatter; import cn.hutool.core.text.StrFormatter;

View File

@ -11,7 +11,6 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAccessor;
import java.util.Date;
public class LocalDateTimeUtilTest { public class LocalDateTimeUtilTest {

View File

@ -11,7 +11,7 @@ import cn.hutool.core.lang.Console;
/** /**
* 文件监听单元测试 * 文件监听单元测试
* *
* @author Looly * @author Looly
* *
*/ */
@ -43,12 +43,12 @@ public class WatchMonitorTest {
Console.log("Overflow{}-> {}", currentPath, obj); Console.log("Overflow{}-> {}", currentPath, obj);
} }
}; };
WatchMonitor monitor = WatchMonitor.createAll("d:/test/aaa.txt", new DelayWatcher(watcher, 500)); WatchMonitor monitor = WatchMonitor.createAll("d:/test/aaa.txt", new DelayWatcher(watcher, 500));
monitor.setMaxDepth(0); monitor.setMaxDepth(0);
monitor.start(); monitor.start();
} }
} }

View File

@ -3,30 +3,30 @@ package cn.hutool.core.lang;
import org.junit.Test; import org.junit.Test;
public class AssertTest { public class AssertTest {
@Test @Test
public void isNullTest(){ public void isNullTest(){
String a = null; String a = null;
cn.hutool.core.lang.Assert.isNull(a); Assert.isNull(a);
} }
@Test @Test
public void notNullTest(){ public void notNullTest(){
String a = null; String a = null;
cn.hutool.core.lang.Assert.isNull(a); Assert.isNull(a);
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void isTrueTest() { public void isTrueTest() {
int i = 0; int i = 0;
//noinspection ConstantConditions //noinspection ConstantConditions
cn.hutool.core.lang.Assert.isTrue(i > 0, IllegalArgumentException::new); Assert.isTrue(i > 0, IllegalArgumentException::new);
} }
@Test(expected = IndexOutOfBoundsException.class) @Test(expected = IndexOutOfBoundsException.class)
public void isTrueTest2() { public void isTrueTest2() {
int i = -1; int i = -1;
//noinspection ConstantConditions //noinspection ConstantConditions
cn.hutool.core.lang.Assert.isTrue(i >= 0, IndexOutOfBoundsException::new); Assert.isTrue(i >= 0, IndexOutOfBoundsException::new);
} }
@Test(expected = IndexOutOfBoundsException.class) @Test(expected = IndexOutOfBoundsException.class)

View File

@ -8,12 +8,12 @@ import org.junit.Test;
/** /**
* ObjectId单元测试 * ObjectId单元测试
* *
* @author looly * @author looly
* *
*/ */
public class ObjectIdTest { public class ObjectIdTest {
@Test @Test
public void distinctTest() { public void distinctTest() {
//生成10000个id测试是否重复 //生成10000个id测试是否重复
@ -21,10 +21,10 @@ public class ObjectIdTest {
for(int i = 0; i < 10000; i++) { for(int i = 0; i < 10000; i++) {
set.add(ObjectId.next()); set.add(ObjectId.next());
} }
Assert.assertEquals(10000, set.size()); Assert.assertEquals(10000, set.size());
} }
@Test @Test
@Ignore @Ignore
public void nextTest() { public void nextTest() {

View File

@ -3,7 +3,7 @@ package cn.hutool.core.lang;
import cn.hutool.core.collection.ConcurrentHashSet; import cn.hutool.core.collection.ConcurrentHashSet;
import cn.hutool.core.exceptions.UtilException; import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore; import org.junit.Ignore;

View File

@ -1,6 +1,7 @@
package cn.hutool.core.lang; package cn.hutool.core.lang;
import cn.hutool.core.collection.ConcurrentHashSet; import cn.hutool.core.collection.ConcurrentHashSet;
import cn.hutool.core.lang.id.UUID;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -1,7 +1,7 @@
package cn.hutool.core.lang; package cn.hutool.core.lang;
import cn.hutool.core.exceptions.ValidateException; import cn.hutool.core.exceptions.ValidateException;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;

View File

@ -9,25 +9,25 @@ import org.junit.Test;
* *
*/ */
public class CallerTest { public class CallerTest {
@Test @Test
public void getCallerTest() { public void getCallerTest() {
Class<?> caller = CallerUtil.getCaller(); Class<?> caller = CallerUtil.getCaller();
Assert.assertEquals(this.getClass(), caller); Assert.assertEquals(this.getClass(), caller);
Class<?> caller0 = CallerUtil.getCaller(0); Class<?> caller0 = CallerUtil.getCaller(0);
Assert.assertEquals(CallerUtil.class, caller0); Assert.assertEquals(CallerUtil.class, caller0);
Class<?> caller1 = CallerUtil.getCaller(1); Class<?> caller1 = CallerUtil.getCaller(1);
Assert.assertEquals(this.getClass(), caller1); Assert.assertEquals(this.getClass(), caller1);
} }
@Test @Test
public void getCallerCallerTest() { public void getCallerCallerTest() {
Class<?> callerCaller = CallerTestClass.getCaller(); Class<?> callerCaller = CallerTestClass.getCaller();
Assert.assertEquals(this.getClass(), callerCaller); Assert.assertEquals(this.getClass(), callerCaller);
} }
private static class CallerTestClass{ private static class CallerTestClass{
public static Class<?> getCaller(){ public static Class<?> getCaller(){
return CallerUtil.getCallerCaller(); return CallerUtil.getCallerCaller();

View File

@ -13,4 +13,4 @@ public class CallerUtilTest {
final String fullCallerMethodName = CallerUtil.getCallerMethodName(true); final String fullCallerMethodName = CallerUtil.getCallerMethodName(true);
Assert.assertEquals("cn.hutool.core.lang.caller.CallerUtilTest.getCallerMethodNameTest", fullCallerMethodName); Assert.assertEquals("cn.hutool.core.lang.caller.CallerUtilTest.getCallerMethodNameTest", fullCallerMethodName);
} }
} }

View File

@ -27,7 +27,7 @@ public class TreeSearchTest {
@Test @Test
public void searchNode() { public void searchNode() {
List<Tree<Long>> treeItems=TreeUtil.build(all_menu, 0L); List<Tree<Long>> treeItems= TreeUtil.build(all_menu, 0L);
Tree<Long> tree=treeItems.get(0); Tree<Long> tree=treeItems.get(0);
Tree<Long> searchResult=tree.getNode(3L); Tree<Long> searchResult=tree.getNode(3L);

View File

@ -14,22 +14,22 @@ import cn.hutool.core.lang.Console;
* *
*/ */
public class ArrangementTest { public class ArrangementTest {
@Test @Test
public void arrangementTest() { public void arrangementTest() {
long result = Arrangement.count(4, 2); long result = Arrangement.count(4, 2);
Assert.assertEquals(12, result); Assert.assertEquals(12, result);
result = Arrangement.count(4, 1); result = Arrangement.count(4, 1);
Assert.assertEquals(4, result); Assert.assertEquals(4, result);
result = Arrangement.count(4, 0); result = Arrangement.count(4, 0);
Assert.assertEquals(1, result); Assert.assertEquals(1, result);
long resultAll = Arrangement.countAll(4); long resultAll = Arrangement.countAll(4);
Assert.assertEquals(64, resultAll); Assert.assertEquals(64, resultAll);
} }
@Test @Test
public void selectTest() { public void selectTest() {
Arrangement arrangement = new Arrangement(new String[] { "1", "2", "3", "4" }); Arrangement arrangement = new Arrangement(new String[] { "1", "2", "3", "4" });
@ -47,14 +47,14 @@ public class ArrangementTest {
Assert.assertArrayEquals(new String[] {"4", "1"}, list.get(9)); Assert.assertArrayEquals(new String[] {"4", "1"}, list.get(9));
Assert.assertArrayEquals(new String[] {"4", "2"}, list.get(10)); Assert.assertArrayEquals(new String[] {"4", "2"}, list.get(10));
Assert.assertArrayEquals(new String[] {"4", "3"}, list.get(11)); Assert.assertArrayEquals(new String[] {"4", "3"}, list.get(11));
List<String[]> selectAll = arrangement.selectAll(); List<String[]> selectAll = arrangement.selectAll();
Assert.assertEquals(Arrangement.countAll(4), selectAll.size()); Assert.assertEquals(Arrangement.countAll(4), selectAll.size());
List<String[]> list2 = arrangement.select(0); List<String[]> list2 = arrangement.select(0);
Assert.assertEquals(1, list2.size()); Assert.assertEquals(1, list2.size());
} }
@Test @Test
@Ignore @Ignore
public void selectTest2() { public void selectTest2() {

View File

@ -6,6 +6,7 @@ import cn.hutool.core.date.TimeInterval;
import cn.hutool.core.exceptions.UtilException; import cn.hutool.core.exceptions.UtilException;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore; import org.junit.Ignore;

View File

@ -21,4 +21,4 @@ public class A {
t.print(); t.print();
}}; }};
} }
} }

View File

@ -4,7 +4,7 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.thread.ExecutorBuilder; import cn.hutool.core.thread.ExecutorBuilder;
import cn.hutool.core.thread.ThreadFactoryBuilder; import cn.hutool.core.thread.ThreadFactoryBuilder;
import cn.hutool.core.util.CharUtil; import cn.hutool.core.util.CharUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.cron.listener.TaskListener; import cn.hutool.cron.listener.TaskListener;
import cn.hutool.cron.listener.TaskListenerManager; import cn.hutool.cron.listener.TaskListenerManager;

View File

@ -11,7 +11,7 @@ import java.util.List;
/** /**
* 定时任务表达式工具类 * 定时任务表达式工具类
* *
* @author looly * @author looly
* *
*/ */
@ -19,7 +19,7 @@ public class CronPatternUtil {
/** /**
* 列举指定日期之后到开始日期对应年年底内第一个匹配表达式的日期 * 列举指定日期之后到开始日期对应年年底内第一个匹配表达式的日期
* *
* @param pattern 表达式 * @param pattern 表达式
* @param start 起始时间 * @param start 起始时间
* @param isMatchSecond 是否匹配秒 * @param isMatchSecond 是否匹配秒
@ -36,7 +36,7 @@ public class CronPatternUtil {
/** /**
* 列举指定日期之后到开始日期对应年年底内所有匹配表达式的日期 * 列举指定日期之后到开始日期对应年年底内所有匹配表达式的日期
* *
* @param patternStr 表达式字符串 * @param patternStr 表达式字符串
* @param start 起始时间 * @param start 起始时间
* @param count 列举数量 * @param count 列举数量
@ -49,7 +49,7 @@ public class CronPatternUtil {
/** /**
* 列举指定日期范围内所有匹配表达式的日期 * 列举指定日期范围内所有匹配表达式的日期
* *
* @param patternStr 表达式字符串 * @param patternStr 表达式字符串
* @param start 起始时间 * @param start 起始时间
* @param end 结束时间 * @param end 结束时间
@ -63,7 +63,7 @@ public class CronPatternUtil {
/** /**
* 列举指定日期范围内所有匹配表达式的日期 * 列举指定日期范围内所有匹配表达式的日期
* *
* @param patternStr 表达式字符串 * @param patternStr 表达式字符串
* @param start 起始时间 * @param start 起始时间
* @param end 结束时间 * @param end 结束时间
@ -77,7 +77,7 @@ public class CronPatternUtil {
/** /**
* 列举指定日期范围内所有匹配表达式的日期 * 列举指定日期范围内所有匹配表达式的日期
* *
* @param pattern 表达式 * @param pattern 表达式
* @param start 起始时间 * @param start 起始时间
* @param end 结束时间 * @param end 结束时间

View File

@ -1,7 +1,7 @@
package cn.hutool.cron; package cn.hutool.cron;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.cron.pattern.CronPattern; import cn.hutool.cron.pattern.CronPattern;
import org.junit.Ignore; import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;

View File

@ -5,7 +5,7 @@ import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.cron.CronUtil; import cn.hutool.cron.CronUtil;
public class AddAndRemoveMainTest { public class AddAndRemoveMainTest {
public static void main(String[] args) { public static void main(String[] args) {
CronUtil.setMatchSecond(true); CronUtil.setMatchSecond(true);
CronUtil.start(false); CronUtil.start(false);

View File

@ -3,7 +3,7 @@ package cn.hutool.cron.demo;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
/** /**
* 测试定时任务当触发到定时的时间点时执行doTest方法 * 测试定时任务当触发到定时的时间点时执行doTest方法

View File

@ -7,7 +7,7 @@ import cn.hutool.core.thread.ThreadUtil;
/** /**
* 测试定时任务当触发到定时的时间点时执行doTest方法 * 测试定时任务当触发到定时的时间点时执行doTest方法
* *
* @author looly * @author looly
* *
*/ */

View File

@ -9,7 +9,7 @@ import cn.hutool.core.map.MapUtil;
/** /**
* 动态实体类<br> * 动态实体类<br>
* 提供了针对自身实体的增删改方法 * 提供了针对自身实体的增删改方法
* *
* @author Looly * @author Looly
* *
*/ */
@ -21,7 +21,7 @@ public class ActiveEntity extends Entity {
// --------------------------------------------------------------- Static method start // --------------------------------------------------------------- Static method start
/** /**
* 创建ActiveEntity * 创建ActiveEntity
* *
* @return ActiveEntity * @return ActiveEntity
*/ */
public static ActiveEntity create() { public static ActiveEntity create() {
@ -30,7 +30,7 @@ public class ActiveEntity extends Entity {
/** /**
* 创建ActiveEntity * 创建ActiveEntity
* *
* @param tableName 表名 * @param tableName 表名
* @return ActiveEntity * @return ActiveEntity
*/ */
@ -40,7 +40,7 @@ public class ActiveEntity extends Entity {
/** /**
* 将PO对象转为Entity * 将PO对象转为Entity
* *
* @param <T> Bean对象类型 * @param <T> Bean对象类型
* @param bean Bean对象 * @param bean Bean对象
* @return ActiveEntity * @return ActiveEntity
@ -51,7 +51,7 @@ public class ActiveEntity extends Entity {
/** /**
* 将PO对象转为ActiveEntity * 将PO对象转为ActiveEntity
* *
* @param <T> Bean对象类型 * @param <T> Bean对象类型
* @param bean Bean对象 * @param bean Bean对象
* @param isToUnderlineCase 是否转换为下划线模式 * @param isToUnderlineCase 是否转换为下划线模式
@ -64,7 +64,7 @@ public class ActiveEntity extends Entity {
/** /**
* 将PO对象转为ActiveEntity,并采用下划线法转换字段 * 将PO对象转为ActiveEntity,并采用下划线法转换字段
* *
* @param <T> Bean对象类型 * @param <T> Bean对象类型
* @param bean Bean对象 * @param bean Bean对象
* @return ActiveEntity * @return ActiveEntity
@ -84,7 +84,7 @@ public class ActiveEntity extends Entity {
/** /**
* 构造 * 构造
* *
* @param tableName 表名 * @param tableName 表名
*/ */
public ActiveEntity(String tableName) { public ActiveEntity(String tableName) {
@ -93,7 +93,7 @@ public class ActiveEntity extends Entity {
/** /**
* 构造 * 构造
* *
* @param entity 非动态实体 * @param entity 非动态实体
*/ */
public ActiveEntity(Entity entity) { public ActiveEntity(Entity entity) {
@ -102,7 +102,7 @@ public class ActiveEntity extends Entity {
/** /**
* 构造 * 构造
* *
* @param db {@link Db} * @param db {@link Db}
* @param tableName 表名 * @param tableName 表名
*/ */
@ -113,7 +113,7 @@ public class ActiveEntity extends Entity {
/** /**
* 构造 * 构造
* *
* @param db {@link Db} * @param db {@link Db}
* @param entity 非动态实体 * @param entity 非动态实体
*/ */
@ -123,17 +123,17 @@ public class ActiveEntity extends Entity {
this.db = db; this.db = db;
} }
// -------------------------------------------------------------------------- Constructor end // -------------------------------------------------------------------------- Constructor end
@Override @Override
public ActiveEntity setTableName(String tableName) { public ActiveEntity setTableName(String tableName) {
return (ActiveEntity) super.setTableName(tableName); return (ActiveEntity) super.setTableName(tableName);
} }
@Override @Override
public ActiveEntity setFieldNames(Collection<String> fieldNames) { public ActiveEntity setFieldNames(Collection<String> fieldNames) {
return (ActiveEntity) super.setFieldNames(fieldNames); return (ActiveEntity) super.setFieldNames(fieldNames);
} }
@Override @Override
public ActiveEntity setFieldNames(String... fieldNames) { public ActiveEntity setFieldNames(String... fieldNames) {
return (ActiveEntity) super.setFieldNames(fieldNames); return (ActiveEntity) super.setFieldNames(fieldNames);
@ -153,27 +153,27 @@ public class ActiveEntity extends Entity {
public ActiveEntity addFieldNames(String... fieldNames) { public ActiveEntity addFieldNames(String... fieldNames) {
return (ActiveEntity) super.addFieldNames(fieldNames); return (ActiveEntity) super.addFieldNames(fieldNames);
} }
@Override @Override
public <T> ActiveEntity parseBean(T bean) { public <T> ActiveEntity parseBean(T bean) {
return (ActiveEntity) super.parseBean(bean); return (ActiveEntity) super.parseBean(bean);
} }
@Override @Override
public <T> ActiveEntity parseBean(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) { public <T> ActiveEntity parseBean(T bean, boolean isToUnderlineCase, boolean ignoreNullValue) {
return (ActiveEntity) super.parseBean(bean, isToUnderlineCase, ignoreNullValue); return (ActiveEntity) super.parseBean(bean, isToUnderlineCase, ignoreNullValue);
} }
@Override @Override
public ActiveEntity set(String field, Object value) { public ActiveEntity set(String field, Object value) {
return (ActiveEntity) super.set(field, value); return (ActiveEntity) super.set(field, value);
} }
@Override @Override
public ActiveEntity setIgnoreNull(String field, Object value) { public ActiveEntity setIgnoreNull(String field, Object value) {
return (ActiveEntity) super.setIgnoreNull(field, value); return (ActiveEntity) super.setIgnoreNull(field, value);
} }
@Override @Override
public ActiveEntity clone() { public ActiveEntity clone() {
return (ActiveEntity) super.clone(); return (ActiveEntity) super.clone();
@ -182,7 +182,7 @@ public class ActiveEntity extends Entity {
// -------------------------------------------------------------------------- CRUD start // -------------------------------------------------------------------------- CRUD start
/** /**
* 根据Entity中现有字段条件从数据库中增加一条数据 * 根据Entity中现有字段条件从数据库中增加一条数据
* *
* @return this * @return this
*/ */
public ActiveEntity add() { public ActiveEntity add() {
@ -196,7 +196,7 @@ public class ActiveEntity extends Entity {
/** /**
* 根据Entity中现有字段条件从数据库中加载一个Entity对象 * 根据Entity中现有字段条件从数据库中加载一个Entity对象
* *
* @return this * @return this
*/ */
public ActiveEntity load() { public ActiveEntity load() {
@ -213,7 +213,7 @@ public class ActiveEntity extends Entity {
/** /**
* 根据现有Entity中的条件删除与之匹配的数据库记录 * 根据现有Entity中的条件删除与之匹配的数据库记录
* *
* @return this * @return this
*/ */
public ActiveEntity del() { public ActiveEntity del() {
@ -227,7 +227,7 @@ public class ActiveEntity extends Entity {
/** /**
* 根据现有Entity中的条件删除与之匹配的数据库记录 * 根据现有Entity中的条件删除与之匹配的数据库记录
* *
* @param primaryKey 主键名 * @param primaryKey 主键名
* @return this * @return this
*/ */

View File

@ -13,20 +13,20 @@ import java.util.List;
/** /**
* SqlRunner线程安全测试 * SqlRunner线程安全测试
* *
* @author looly * @author looly
* *
*/ */
@Ignore @Ignore
public class ConcurentTest { public class ConcurentTest {
private Db db; private Db db;
@Before @Before
public void init() { public void init() {
db = Db.use("test"); db = Db.use("test");
} }
@Test @Test
public void findTest() { public void findTest() {
for(int i = 0; i < 10000; i++) { for(int i = 0; i < 10000; i++) {
@ -40,7 +40,7 @@ public class ConcurentTest {
Console.log(find); Console.log(find);
}); });
} }
//主线程关闭会导致连接池销毁sleep避免此情况引起的问题 //主线程关闭会导致连接池销毁sleep避免此情况引起的问题
ThreadUtil.sleep(5000); ThreadUtil.sleep(5000);
} }

View File

@ -1,7 +1,6 @@
package cn.hutool.db; package cn.hutool.db;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.util.ArrayUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Ignore; import org.junit.Ignore;

View File

@ -12,7 +12,7 @@ import java.sql.SQLException;
/** /**
* Oracle操作单元测试 * Oracle操作单元测试
* *
* @author looly * @author looly
* *
*/ */

View File

@ -9,12 +9,12 @@ import cn.hutool.core.lang.Console;
/** /**
* SQL Server操作单元测试 * SQL Server操作单元测试
* *
* @author looly * @author looly
* *
*/ */
public class SqlServerTest { public class SqlServerTest {
@Test @Test
@Ignore @Ignore
public void createTableTest() throws SQLException { public void createTableTest() throws SQLException {

View File

@ -1,7 +1,7 @@
package cn.hutool.extra.template.engine.enjoy; package cn.hutool.extra.template.engine.enjoy;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.template.Template; import cn.hutool.extra.template.Template;
import cn.hutool.extra.template.TemplateConfig; import cn.hutool.extra.template.TemplateConfig;

View File

@ -11,7 +11,7 @@ import java.util.Map;
/** /**
* Rythm模板包装 * Rythm模板包装
* *
* @author looly * @author looly
* *
*/ */
@ -19,20 +19,20 @@ public class RythmTemplate extends AbstractTemplate implements Serializable {
private static final long serialVersionUID = -132774960373894911L; private static final long serialVersionUID = -132774960373894911L;
private final org.rythmengine.template.ITemplate rawTemplate; private final org.rythmengine.template.ITemplate rawTemplate;
/** /**
* 包装Rythm模板 * 包装Rythm模板
* *
* @param template Rythm的模板对象 {@link org.rythmengine.template.ITemplate} * @param template Rythm的模板对象 {@link org.rythmengine.template.ITemplate}
* @return {@link RythmTemplate} * @return {@link RythmTemplate}
*/ */
public static RythmTemplate wrap(org.rythmengine.template.ITemplate template) { public static RythmTemplate wrap(org.rythmengine.template.ITemplate template) {
return (null == template) ? null : new RythmTemplate(template); return (null == template) ? null : new RythmTemplate(template);
} }
/** /**
* 构造 * 构造
* *
* @param rawTemplate Velocity模板对象 * @param rawTemplate Velocity模板对象
*/ */
public RythmTemplate(org.rythmengine.template.ITemplate rawTemplate) { public RythmTemplate(org.rythmengine.template.ITemplate rawTemplate) {

View File

@ -18,7 +18,7 @@ import java.util.Map;
/** /**
* Thymeleaf模板实现 * Thymeleaf模板实现
* *
* @author looly * @author looly
* @since 4.1.11 * @since 4.1.11
*/ */
@ -31,7 +31,7 @@ public class ThymeleafTemplate extends AbstractTemplate implements Serializable
/** /**
* 包装Thymeleaf模板 * 包装Thymeleaf模板
* *
* @param engine Thymeleaf的模板引擎对象 {@link TemplateEngine} * @param engine Thymeleaf的模板引擎对象 {@link TemplateEngine}
* @param template 模板路径或模板内容 * @param template 模板路径或模板内容
* @param charset 编码 * @param charset 编码
@ -43,7 +43,7 @@ public class ThymeleafTemplate extends AbstractTemplate implements Serializable
/** /**
* 构造 * 构造
* *
* @param engine Thymeleaf的模板对象 {@link TemplateEngine} * @param engine Thymeleaf的模板对象 {@link TemplateEngine}
* @param template 模板路径或模板内容 * @param template 模板路径或模板内容
* @param charset 编码 * @param charset 编码

View File

@ -9,7 +9,7 @@ import cn.hutool.log.StaticLog;
/** /**
* 简单分词引擎工厂用于根据用户引入的分词引擎jar自动创建对应的引擎 * 简单分词引擎工厂用于根据用户引入的分词引擎jar自动创建对应的引擎
* *
* @author looly * @author looly
* *
*/ */
@ -28,7 +28,7 @@ public class TokenizerFactory {
/** /**
* 根据用户引入的分词引擎jar自动创建对应的分词引擎对象 * 根据用户引入的分词引擎jar自动创建对应的分词引擎对象
* *
* @return {@link TokenizerEngine} * @return {@link TokenizerEngine}
*/ */
public static TokenizerEngine create() { public static TokenizerEngine create() {
@ -39,7 +39,7 @@ public class TokenizerFactory {
/** /**
* 根据用户引入的分词引擎jar自动创建对应的分词引擎对象 * 根据用户引入的分词引擎jar自动创建对应的分词引擎对象
* *
* @return {@link TokenizerEngine} * @return {@link TokenizerEngine}
*/ */
private static TokenizerEngine doCreate() { private static TokenizerEngine doCreate() {

View File

@ -9,7 +9,7 @@ import org.junit.Test;
/** /**
* Jsch工具类单元测试 * Jsch工具类单元测试
* *
* @author looly * @author looly
* *
*/ */
@ -47,7 +47,7 @@ public class JschUtilTest {
sftp.mkDirs("/opt/test/aaa/bbb"); sftp.mkDirs("/opt/test/aaa/bbb");
Console.log("OK"); Console.log("OK");
} }
@Test @Test
@Ignore @Ignore
public void reconnectIfTimeoutTest() throws InterruptedException { public void reconnectIfTimeoutTest() throws InterruptedException {

View File

@ -19,7 +19,7 @@ import cn.hutool.extra.template.engine.thymeleaf.ThymeleafEngine;
/** /**
* Thymeleaf单元测试 * Thymeleaf单元测试
* *
* @author looly * @author looly
* *
*/ */

View File

@ -14,12 +14,12 @@ public class Issue488Test {
@Test @Test
public void toBeanTest() { public void toBeanTest() {
String jsonStr = ResourceUtil.readUtf8Str("issue488.json"); String jsonStr = ResourceUtil.readUtf8Str("issue488.json");
ResultSuccess<List<EmailAddress>> result = JSONUtil.toBean(jsonStr, ResultSuccess<List<EmailAddress>> result = JSONUtil.toBean(jsonStr,
new TypeReference<ResultSuccess<List<EmailAddress>>>() {}, false); new TypeReference<ResultSuccess<List<EmailAddress>>>() {}, false);
Assert.assertEquals("https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.emailAddress)", result.getContext()); Assert.assertEquals("https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.emailAddress)", result.getContext());
List<EmailAddress> adds = result.getValue(); List<EmailAddress> adds = result.getValue();
Assert.assertEquals("会议室101", adds.get(0).getName()); Assert.assertEquals("会议室101", adds.get(0).getName());
Assert.assertEquals("MeetingRoom101@abc.com", adds.get(0).getAddress()); Assert.assertEquals("MeetingRoom101@abc.com", adds.get(0).getAddress());

View File

@ -10,31 +10,31 @@ import cn.hutool.core.lang.TypeReference;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
public class IssueIVMD5Test { public class IssueIVMD5Test {
/** /**
* 测试泛型对象中有泛型字段的转换成功与否 * 测试泛型对象中有泛型字段的转换成功与否
*/ */
@Test @Test
public void toBeanTest() { public void toBeanTest() {
String jsonStr = ResourceUtil.readUtf8Str("issueIVMD5.json"); String jsonStr = ResourceUtil.readUtf8Str("issueIVMD5.json");
TypeReference<BaseResult<StudentInfo>> typeReference = new TypeReference<BaseResult<StudentInfo>>() {}; TypeReference<BaseResult<StudentInfo>> typeReference = new TypeReference<BaseResult<StudentInfo>>() {};
BaseResult<StudentInfo> bean = JSONUtil.toBean(jsonStr, typeReference.getType(), false); BaseResult<StudentInfo> bean = JSONUtil.toBean(jsonStr, typeReference.getType(), false);
StudentInfo data2 = bean.getData2(); StudentInfo data2 = bean.getData2();
Assert.assertEquals("B4DDF491FDF34074AE7A819E1341CB6C", data2.getAccountId()); Assert.assertEquals("B4DDF491FDF34074AE7A819E1341CB6C", data2.getAccountId());
} }
/** /**
* 测试泛型对象中有包含泛型字段的类型的转换成功与否比如List&lt;T&gt; list * 测试泛型对象中有包含泛型字段的类型的转换成功与否比如List&lt;T&gt; list
*/ */
@Test @Test
public void toBeanTest2() { public void toBeanTest2() {
String jsonStr = ResourceUtil.readUtf8Str("issueIVMD5.json"); String jsonStr = ResourceUtil.readUtf8Str("issueIVMD5.json");
TypeReference<BaseResult<StudentInfo>> typeReference = new TypeReference<BaseResult<StudentInfo>>() {}; TypeReference<BaseResult<StudentInfo>> typeReference = new TypeReference<BaseResult<StudentInfo>>() {};
BaseResult<StudentInfo> bean = JSONUtil.toBean(jsonStr, typeReference.getType(), false); BaseResult<StudentInfo> bean = JSONUtil.toBean(jsonStr, typeReference.getType(), false);
List<StudentInfo> data = bean.getData(); List<StudentInfo> data = bean.getData();
StudentInfo studentInfo = data.get(0); StudentInfo studentInfo = data.get(0);
Assert.assertEquals("B4DDF491FDF34074AE7A819E1341CB6C", studentInfo.getAccountId()); Assert.assertEquals("B4DDF491FDF34074AE7A819E1341CB6C", studentInfo.getAccountId());

View File

@ -10,7 +10,7 @@ import cn.hutool.log.level.WarnLog;
/** /**
* 日志统一接口 * 日志统一接口
* *
* @author Looly * @author Looly
* *
*/ */

View File

@ -16,7 +16,7 @@ import cn.hutool.log.LogFactory;
* *
*/ */
public class JdkLogFactory extends LogFactory{ public class JdkLogFactory extends LogFactory{
public JdkLogFactory() { public JdkLogFactory() {
super("JDK Logging"); super("JDK Logging");
readConfig(); readConfig();
@ -31,7 +31,7 @@ public class JdkLogFactory extends LogFactory{
public Log createLog(Class<?> clazz) { public Log createLog(Class<?> clazz) {
return new JdkLog(clazz); return new JdkLog(clazz);
} }
/** /**
* 读取ClassPath下的logging.properties配置文件 * 读取ClassPath下的logging.properties配置文件
*/ */
@ -42,7 +42,7 @@ public class JdkLogFactory extends LogFactory{
System.err.println("[WARN] Can not find [logging.properties], use [%JRE_HOME%/lib/logging.properties] as default!"); System.err.println("[WARN] Can not find [logging.properties], use [%JRE_HOME%/lib/logging.properties] as default!");
return; return;
} }
try { try {
LogManager.getLogManager().readConfiguration(in); LogManager.getLogManager().readConfiguration(in);
} catch (Exception e) { } catch (Exception e) {

View File

@ -12,7 +12,7 @@ import cn.hutool.core.map.TableMap;
import cn.hutool.core.map.multi.RowKeyTable; import cn.hutool.core.map.multi.RowKeyTable;
import cn.hutool.core.map.multi.Table; import cn.hutool.core.map.multi.Table;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.core.util.URLUtil; import cn.hutool.core.util.URLUtil;
import cn.hutool.poi.excel.cell.CellLocation; import cn.hutool.poi.excel.cell.CellLocation;

View File

@ -16,15 +16,15 @@ import java.util.Map;
/** /**
* Word中表格相关工具 * Word中表格相关工具
* *
* @author Looly * @author Looly
* @since 4.5.14 * @since 4.5.14
*/ */
public class TableUtil { public class TableUtil {
/** /**
* 创建空表只有一行 * 创建空表只有一行
* *
* @param doc {@link XWPFDocument} * @param doc {@link XWPFDocument}
* @return {@link XWPFTable} * @return {@link XWPFTable}
*/ */
@ -34,7 +34,7 @@ public class TableUtil {
/** /**
* 创建表格并填充数据默认表格 * 创建表格并填充数据默认表格
* *
* @param doc {@link XWPFDocument} * @param doc {@link XWPFDocument}
* @param data 数据 * @param data 数据
* @return {@link XWPFTable} * @return {@link XWPFTable}
@ -72,10 +72,10 @@ public class TableUtil {
return table; return table;
} }
/** /**
* 写一行数据 * 写一行数据
* *
* @param row * @param row
* @param rowBean 行数据 * @param rowBean 行数据
* @param isWriteKeyAsHead 如果为Map或者Bean是否写标题 * @param isWriteKeyAsHead 如果为Map或者Bean是否写标题
@ -86,7 +86,7 @@ public class TableUtil {
writeRow(row, (Iterable<?>) rowBean); writeRow(row, (Iterable<?>) rowBean);
return; return;
} }
Map rowMap; Map rowMap;
if(rowBean instanceof Map) { if(rowBean instanceof Map) {
rowMap = (Map) rowBean; rowMap = (Map) rowBean;
@ -100,10 +100,10 @@ public class TableUtil {
writeRow(row, rowMap, isWriteKeyAsHead); writeRow(row, rowMap, isWriteKeyAsHead);
} }
/** /**
* 写行数据 * 写行数据
* *
* @param row * @param row
* @param rowMap 行数据 * @param rowMap 行数据
* @param isWriteKeyAsHead 是否写标题 * @param isWriteKeyAsHead 是否写标题
@ -122,7 +122,7 @@ public class TableUtil {
/** /**
* 写行数据 * 写行数据
* *
* @param row * @param row
* @param rowData 行数据 * @param rowData 行数据
*/ */
@ -139,7 +139,7 @@ public class TableUtil {
/** /**
* 获取或创建新行<br> * 获取或创建新行<br>
* 存在则直接返回不存在创建新的行 * 存在则直接返回不存在创建新的行
* *
* @param table {@link XWPFTable} * @param table {@link XWPFTable}
* @param index 索引行号从0开始 * @param index 索引行号从0开始
* @return {@link XWPFTableRow} * @return {@link XWPFTableRow}
@ -156,7 +156,7 @@ public class TableUtil {
/** /**
* 获取或创建新单元格<br> * 获取或创建新单元格<br>
* 存在则直接返回不存在创建新的单元格 * 存在则直接返回不存在创建新的单元格
* *
* @param row {@link XWPFTableRow} * @param row {@link XWPFTableRow}
* @param index index 索引列号从0开始 * @param index index 索引列号从0开始
* @return {@link XWPFTableCell} * @return {@link XWPFTableCell}

View File

@ -7,7 +7,7 @@ import org.junit.Test;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
public class CellUtilTest { public class CellUtilTest {
@Test @Test
@Ignore @Ignore
public void isDateTest() { public void isDateTest() {

View File

@ -7,7 +7,7 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Console; import cn.hutool.core.lang.Console;
import cn.hutool.core.map.MapUtil; import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.lang.id.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.poi.excel.cell.setters.EscapeStrCellSetter; import cn.hutool.poi.excel.cell.setters.EscapeStrCellSetter;
import cn.hutool.poi.excel.style.StyleUtil; import cn.hutool.poi.excel.style.StyleUtil;

View File

@ -5,7 +5,7 @@ import cn.hutool.setting.Setting;
/** /**
* 全局的Profile配置中心 * 全局的Profile配置中心
* *
* @author Looly * @author Looly
* *
*/ */

View File

@ -19,7 +19,7 @@ import java.util.concurrent.ConcurrentHashMap;
* <li>develop = ${classpath}/develop/db.setting</li> * <li>develop = ${classpath}/develop/db.setting</li>
* <li>production = ${classpath}/production/db.setting</li> * <li>production = ${classpath}/production/db.setting</li>
* </ol> * </ol>
* *
* @author Looly * @author Looly
* *
*/ */
@ -48,7 +48,7 @@ public class Profile implements Serializable {
/** /**
* 构造编码UTF-8不使用变量 * 构造编码UTF-8不使用变量
* *
* @param profile 环境 * @param profile 环境
*/ */
public Profile(String profile) { public Profile(String profile) {
@ -57,7 +57,7 @@ public class Profile implements Serializable {
/** /**
* 构造 * 构造
* *
* @param profile 环境 * @param profile 环境
* @param charset 编码 * @param charset 编码
* @param useVar 是否使用变量 * @param useVar 是否使用变量
@ -71,7 +71,7 @@ public class Profile implements Serializable {
/** /**
* 获取当前环境下的配置文件 * 获取当前环境下的配置文件
* *
* @param name 文件名如果没有扩展名默认为.setting * @param name 文件名如果没有扩展名默认为.setting
* @return 当前环境下配置文件 * @return 当前环境下配置文件
*/ */
@ -87,7 +87,7 @@ public class Profile implements Serializable {
/** /**
* 设置环境 * 设置环境
* *
* @param profile 环境 * @param profile 环境
* @return 自身 * @return 自身
*/ */
@ -98,7 +98,7 @@ public class Profile implements Serializable {
/** /**
* 设置编码 * 设置编码
* *
* @param charset 编码 * @param charset 编码
* @return 自身 * @return 自身
*/ */
@ -109,7 +109,7 @@ public class Profile implements Serializable {
/** /**
* 设置是否使用变量 * 设置是否使用变量
* *
* @param useVar 变量 * @param useVar 变量
* @return 自身 * @return 自身
*/ */
@ -120,7 +120,7 @@ public class Profile implements Serializable {
/** /**
* 清空所有环境的配置文件 * 清空所有环境的配置文件
* *
* @return 自身 * @return 自身
*/ */
public Profile clear() { public Profile clear() {
@ -131,7 +131,7 @@ public class Profile implements Serializable {
// -------------------------------------------------------------------------------- Private method start // -------------------------------------------------------------------------------- Private method start
/** /**
* 修正文件名 * 修正文件名
* *
* @param name 文件名 * @param name 文件名
* @return 修正后的文件名 * @return 修正后的文件名
*/ */

View File

@ -9,7 +9,7 @@ import java.nio.ByteBuffer;
public class AioClientTest { public class AioClientTest {
public static void main(String[] args) { public static void main(String[] args) {
AioClient client = new AioClient(new InetSocketAddress("localhost", 8899), new SimpleIoAction() { AioClient client = new AioClient(new InetSocketAddress("localhost", 8899), new SimpleIoAction() {
@Override @Override
public void doAction(AioSession session, ByteBuffer data) { public void doAction(AioSession session, ByteBuffer data) {
if(data.hasRemaining()) { if(data.hasRemaining()) {
@ -19,10 +19,10 @@ public class AioClientTest {
Console.log("OK"); Console.log("OK");
} }
}); });
client.write(ByteBuffer.wrap("Hello".getBytes())); client.write(ByteBuffer.wrap("Hello".getBytes()));
client.read(); client.read();
client.close(); client.close();
} }
} }

View File

@ -9,23 +9,23 @@ import cn.hutool.log.StaticLog;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
public class AioServerTest { public class AioServerTest {
public static void main(String[] args) { public static void main(String[] args) {
@SuppressWarnings("resource") @SuppressWarnings("resource")
AioServer aioServer = new AioServer(8899); AioServer aioServer = new AioServer(8899);
aioServer.setIoAction(new SimpleIoAction() { aioServer.setIoAction(new SimpleIoAction() {
@Override @Override
public void accept(AioSession session) { public void accept(AioSession session) {
StaticLog.debug("【客户端】:{} 连接。", session.getRemoteAddress()); StaticLog.debug("【客户端】:{} 连接。", session.getRemoteAddress());
session.write(BufferUtil.createUtf8("=== Welcome to Hutool socket server. ===")); session.write(BufferUtil.createUtf8("=== Welcome to Hutool socket server. ==="));
} }
@Override @Override
public void doAction(AioSession session, ByteBuffer data) { public void doAction(AioSession session, ByteBuffer data) {
Console.log(data); Console.log(data);
if(false == data.hasRemaining()) { if(false == data.hasRemaining()) {
StringBuilder response = StrUtil.builder()// StringBuilder response = StrUtil.builder()//
.append("HTTP/1.1 200 OK\r\n")// .append("HTTP/1.1 200 OK\r\n")//

View File

@ -47,4 +47,4 @@ public class NioClientTest {
} }
} }
} }
} }

View File

@ -47,4 +47,4 @@ public class NioServerTest {
//将缓冲数据写入渠道返回给客户端 //将缓冲数据写入渠道返回给客户端
channel.write(BufferUtil.createUtf8(response)); channel.write(BufferUtil.createUtf8(response));
} }
} }

View File

@ -16,7 +16,7 @@ public class ClipboardMonitorTest {
Console.log("1# {}", object); Console.log("1# {}", object);
return contents; return contents;
}, false); }, false);
// 第二个监听 // 第二个监听
ClipboardUtil.listen((clipboard, contents) -> { ClipboardUtil.listen((clipboard, contents) -> {
Object object = ClipboardUtil.getStr(contents); Object object = ClipboardUtil.getStr(contents);