本文整理了Java中cn.hutool.core.bean.BeanUtil.fillBean()
方法的一些代码示例,展示了BeanUtil.fillBean()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BeanUtil.fillBean()
方法的具体详情如下:
包路径:cn.hutool.core.bean.BeanUtil
类名称:BeanUtil
方法名:fillBean
[英]填充Bean的核心方法
[中]填充豆的核心方法
代码示例来源:origin: looly/hutool
/**
* ServletRequest 参数转Bean
*
* @param <T> Bean类型
* @param beanClass Bean Class
* @param valueProvider 值提供者
* @param copyOptions 拷贝选项,见 {@link CopyOptions}
* @return Bean
*/
public static <T> T toBean(Class<T> beanClass, ValueProvider<String> valueProvider, CopyOptions copyOptions) {
return fillBean(ReflectUtil.newInstance(beanClass), valueProvider, copyOptions);
}
代码示例来源:origin: looly/hutool
/**
* ServletRequest 参数转Bean
*
* @param <T> Bean类型
* @param beanClass Bean Class
* @param valueProvider 值提供者
* @param copyOptions 拷贝选项,见 {@link CopyOptions}
* @return Bean
*/
public static <T> T toBean(Class<T> beanClass, ValueProvider<String> valueProvider, CopyOptions copyOptions) {
return fillBean(ReflectUtil.newInstance(beanClass), valueProvider, copyOptions);
}
代码示例来源:origin: looly/hutool
/**
* 将setting中的键值关系映射到对象中,原理是调用对象对应的set方法<br>
* 只支持基本类型的转换
*
* @param group 分组
* @param bean Bean对象
* @return Bean
*/
public Object toBean(final String group, Object bean) {
return BeanUtil.fillBean(bean, new ValueProvider<String>(){
@Override
public Object value(String key, Type valueType) {
final String value = getByGroup(key, group);
// if (null != value) {
// log.debug("Parse setting to object field [{}={}]", key, value);
// }
return value;
}
@Override
public boolean containsKey(String key) {
return null != getByGroup(key, group);
}
}, CopyOptions.create());
}
代码示例来源:origin: looly/hutool
/**
* 将setting中的键值关系映射到对象中,原理是调用对象对应的set方法<br>
* 只支持基本类型的转换
*
* @param group 分组
* @param bean Bean对象
* @return Bean
*/
public Object toBean(final String group, Object bean) {
return BeanUtil.fillBean(bean, new ValueProvider<String>(){
@Override
public Object value(String key, Type valueType) {
final String value = getByGroup(key, group);
// if (null != value) {
// log.debug("Parse setting to object field [{}={}]", key, value);
// }
return value;
}
@Override
public boolean containsKey(String key) {
return null != getByGroup(key, group);
}
}, CopyOptions.create());
}
代码示例来源:origin: looly/hutool
return BeanUtil.fillBean(bean, new ValueProvider<String>() {
@Override
public Object value(String key, Type valueType) {
代码示例来源:origin: looly/hutool
return BeanUtil.fillBean(bean, new ValueProvider<String>() {
@Override
public Object value(String key, Type valueType) {
代码示例来源:origin: cn.hutool/hutool-all
/**
* ServletRequest 参数转Bean
*
* @param <T> Bean类型
* @param beanClass Bean Class
* @param valueProvider 值提供者
* @param copyOptions 拷贝选项,见 {@link CopyOptions}
* @return Bean
*/
public static <T> T toBean(Class<T> beanClass, ValueProvider<String> valueProvider, CopyOptions copyOptions) {
return fillBean(ReflectUtil.newInstance(beanClass), valueProvider, copyOptions);
}
代码示例来源:origin: cn.hutool/hutool-all
/**
* 将setting中的键值关系映射到对象中,原理是调用对象对应的set方法<br>
* 只支持基本类型的转换
*
* @param group 分组
* @param bean Bean对象
* @return Bean
*/
public Object toBean(final String group, Object bean) {
return BeanUtil.fillBean(bean, new ValueProvider<String>(){
@Override
public Object value(String key, Type valueType) {
final String value = getByGroup(key, group);
// if (null != value) {
// log.debug("Parse setting to object field [{}={}]", key, value);
// }
return value;
}
@Override
public boolean containsKey(String key) {
return null != getByGroup(key, group);
}
}, CopyOptions.create());
}
代码示例来源:origin: cn.hutool/hutool-setting
/**
* 将setting中的键值关系映射到对象中,原理是调用对象对应的set方法<br>
* 只支持基本类型的转换
*
* @param group 分组
* @param bean Bean对象
* @return Bean
*/
public Object toBean(final String group, Object bean) {
return BeanUtil.fillBean(bean, new ValueProvider<String>(){
@Override
public Object value(String key, Type valueType) {
final String value = getByGroup(key, group);
// if (null != value) {
// log.debug("Parse setting to object field [{}={}]", key, value);
// }
return value;
}
@Override
public boolean containsKey(String key) {
return null != getByGroup(key, group);
}
}, CopyOptions.create());
}
代码示例来源:origin: cn.hutool/hutool-all
return BeanUtil.fillBean(bean, new ValueProvider<String>() {
@Override
public Object value(String key, Type valueType) {
内容来源于网络,如有侵权,请联系作者删除!