Skip to content
This repository was archived by the owner on Nov 21, 2020. It is now read-only.

Commit 6d02613

Browse files
committed
feat: add init method for base bean
1 parent bd468b0 commit 6d02613

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/main/java/org/code4everything/boot/base/bean/BaseBean.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
*/
1717
public interface BaseBean {
1818

19+
/**
20+
* 初始化对象,调用者需重写此方法并手动调用
21+
*
22+
* @since 1.1.6
23+
*/
24+
default void init() {}
25+
1926
/**
2027
* 将空指针的属性设为默认值
2128
*
@@ -83,7 +90,7 @@ default void requireNonNullProperty() {
8390
Field[] fields = ReflectUtil.getFields(this.getClass());
8491
for (Field field : fields) {
8592
if (ObjectUtil.isNotNull(field) && Objects.isNull(ReflectUtil.getFieldValue(this, field))) {
86-
throw new NullPointerException("the value of field '" + field.getName() + "' at class '" + this.getClass().getName() + "' must not be null");
93+
throw new NullPointerException("the value of field '" + field.getName() + "' in class '" + this.getClass().getName() + "' must not be null");
8794
}
8895
}
8996
}
@@ -99,7 +106,7 @@ default void requireNonNullProperty() {
99106
* @since 1.0.6
100107
*/
101108
default <T> T copyInto(T target) {
102-
Objects.requireNonNull(target, "param must not be null");
109+
Objects.requireNonNull(target, "target must not be null");
103110
BeanUtil.copyProperties(this, target);
104111
return target;
105112
}

0 commit comments

Comments
 (0)