mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
feat: optimize FieldWrapper.java
This commit is contained in:
parent
f8f9583bfc
commit
ab7e705b45
@ -53,7 +53,7 @@ public class FieldWrapper {
|
||||
if (fieldWrapper == null) {
|
||||
Field findField = ClassUtil.getFirstField(clazz, field -> field.getName().equals(fieldName));
|
||||
if (findField == null) {
|
||||
throw new IllegalStateException("Can not find field \"" + fieldName + "\" in class: " + clazz);
|
||||
throw new IllegalStateException("Can not find field \"" + fieldName + "\" in class: " + clazz.getName());
|
||||
}
|
||||
|
||||
String setterName = "set" + StringUtil.firstCharToUpperCase(fieldName);
|
||||
@ -117,7 +117,7 @@ public class FieldWrapper {
|
||||
public void set(Object value, Object to) {
|
||||
try {
|
||||
if (setterMethod == null) {
|
||||
throw new IllegalStateException("Can not find method \"set" + StringUtil.firstCharToUpperCase(field.getName()) + "\" in class: " + to.getClass());
|
||||
throw new IllegalStateException("Can not find method \"set" + StringUtil.firstCharToUpperCase(field.getName()) + "\" in class: " + to.getClass().getName());
|
||||
}
|
||||
setterMethod.invoke(to, value);
|
||||
} catch (Exception e) {
|
||||
@ -128,7 +128,8 @@ public class FieldWrapper {
|
||||
public Object get(Object target) {
|
||||
try {
|
||||
if (getterMethod == null) {
|
||||
throw new IllegalStateException("Can not find method \"get" + StringUtil.firstCharToUpperCase(field.getName()) + ", is" + StringUtil.firstCharToUpperCase(field.getName()) + "\" in class: " + target.getClass());
|
||||
throw new IllegalStateException("Can not find method \"get" + StringUtil.firstCharToUpperCase(field.getName()) + ", is"
|
||||
+ StringUtil.firstCharToUpperCase(field.getName()) + "\" in class: " + target.getClass().getName());
|
||||
}
|
||||
return getterMethod.invoke(target);
|
||||
} catch (Exception e) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user