招标书-
javabean
对象自动赋值给另一个
javabean
对象
把
JavaBean
的
from
的值自动
set
给
to
,省略了自己从
from
中
get
然后再< br>set
给
to
public static Object convertBean2Bean(Object from, Object to) {
try {
BeanInfo beanInfo = nInfo(ss());
PropertyDescriptor[] ps = pertyDescriptors();
for (PropertyDescriptor p : ps) {
Method getMethod = dMethod();
Method setMethod = teMethod();
if (getMethod != null && setMethod != null) {
try {
Object result = (from);
(to, result);
} catch (Exception e) {
//
如果
from
没有此属性的
get
方法,跳过
continue;
}
}
}
} catch (Exception e) {
tackTrace();
}
return to;
}
/**
*
不支持
to
继承
(to
是其他
bean
的子类
)
*/
public static Object coverBean2Bean(Object from, Object to) {
Class fClass = ss();
Class tClass = ss();
//
拿
to
所有属性(如果有继承,父类属性拿不到)
Field[] cFields = laredFields();
try {
for (Field field : cFields) {
String cKey = e();
//
确定第一个字母大写
cKey = ing(0, 1).toUpperCase() + ing(1);
招标书-
招标书-
招标书-
招标书-
招标书-
招标书-
招标书-
招标书-
本文更新与2021-01-25 23:34,由作者提供,不代表本网站立场,转载请注明出处:https://www.bjmy2z.cn/gaokao/567712.html
-
上一篇:Another 表示不确定数目中的另一个
下一篇:《推开教育的另一扇窗》读书心得