This commit is contained in:
Looly 2022-02-07 17:03:05 +08:00
parent a547909d5e
commit da4c1d3bf7
2 changed files with 3 additions and 4 deletions

View File

@ -45,10 +45,7 @@ import java.util.function.Supplier;
* .with(Box::alis)
* .build();
* </pre>
* <p>注意本工具类支持调用的方法的参数数量不超过5个更多的参数不利于阅读和维护
* 关于Java方法的参数个数限制似乎并没有明确统一的规范网络上众说纷纭这里取个相对平均的数5
* 特殊需要求可以基于此类进行拓展.
* </p>
* <p>注意本工具类支持调用的方法的参数数量不超过1个更多的参数不利于阅读和维护</p>
*
* @author TomXin
* @since 5.7.21

View File

@ -32,6 +32,7 @@ public class GenericBuilderTest {
Assert.assertEquals(8, box.getWidth().intValue());
Assert.assertEquals(7, box.getHeight().intValue());
// 对象修改
Box boxModified = GenericBuilder
.of(() -> box)
.with(Box::setTitle, "Hello Friend!")
@ -46,6 +47,7 @@ public class GenericBuilderTest {
Assert.assertEquals(4, boxModified.getWidth().intValue());
Assert.assertEquals(5, boxModified.getHeight().intValue());
// 多参数构造
Box box1 = GenericBuilder
.of(Box::new, 2048L, "Hello Partner!", 222, 333, 444)
.with(Box::alis)