本文整理了Java中cn.hutool.core.bean.BeanUtil.getBeanDesc()
方法的一些代码示例,展示了BeanUtil.getBeanDesc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BeanUtil.getBeanDesc()
方法的具体详情如下:
包路径:cn.hutool.core.bean.BeanUtil
类名称:BeanUtil
方法名:getBeanDesc
[英]获取 BeanDesc Bean描述信息
[中]获取 豆角描述信息
代码示例来源:origin: looly/hutool
/**
* 构造
*
* @param bean Bean
* @param ignoreCase 是否忽略字段大小写
* @param ignoreError 是否忽略字段值读取错误
*/
public BeanValueProvider(Object bean, boolean ignoreCase, boolean ignoreError) {
this.source = bean;
this.ignoreError = ignoreError;
sourcePdMap = BeanUtil.getBeanDesc(source.getClass()).getPropMap(ignoreCase);
}
代码示例来源:origin: looly/hutool
/**
* 构造
*
* @param bean Bean
* @param ignoreCase 是否忽略字段大小写
* @param ignoreError 是否忽略字段值读取错误
*/
public BeanValueProvider(Object bean, boolean ignoreCase, boolean ignoreError) {
this.source = bean;
this.ignoreError = ignoreError;
sourcePdMap = BeanUtil.getBeanDesc(source.getClass()).getPropMap(ignoreCase);
}
代码示例来源:origin: looly/hutool
/**
* 设置字段值
* @param fieldName 字段名
* @param value 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void set(String fieldName, Object value) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
((Map)bean).put(fieldName, value);
return;
}else{
try {
final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
if(null == setter){
throw new BeanException("No set method for {}", fieldName);
}
setter.invoke(this.bean, value);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
代码示例来源:origin: looly/hutool
/**
* 设置字段值
* @param fieldName 字段名
* @param value 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void set(String fieldName, Object value) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
((Map)bean).put(fieldName, value);
return;
}else{
try {
final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
if(null == setter){
throw new BeanException("No set method for {}", fieldName);
}
setter.invoke(this.bean, value);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
代码示例来源:origin: looly/hutool
/**
* 获得字段对应值
* @param <T> 属性值类型
* @param fieldName 字段名
* @return 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
代码示例来源:origin: looly/hutool
/**
* 获得字段对应值
* @param <T> 属性值类型
* @param fieldName 字段名
* @return 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
代码示例来源:origin: looly/hutool
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
代码示例来源:origin: looly/hutool
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
代码示例来源:origin: looly/hutool
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
代码示例来源:origin: looly/hutool
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
代码示例来源:origin: looly/hutool
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
final HashSet<String> ignoreSet = (null != copyOptions.ignoreProperties) ? CollUtil.newHashSet(copyOptions.ignoreProperties) : null;
final CopyOptions copyOptions = this.copyOptions;
代码示例来源:origin: looly/hutool
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
final HashSet<String> ignoreSet = (null != copyOptions.ignoreProperties) ? CollUtil.newHashSet(copyOptions.ignoreProperties) : null;
final CopyOptions copyOptions = this.copyOptions;
代码示例来源:origin: looly/hutool
final Map<String, PropDesc> propMap = BeanUtil.getBeanDesc(beanClass).getPropMap(true);
String columnLabel;
PropDesc pd;
代码示例来源:origin: looly/hutool
final Map<String, PropDesc> propMap = BeanUtil.getBeanDesc(beanClass).getPropMap(true);
String columnLabel;
PropDesc pd;
代码示例来源:origin: looly/hutool
final Map<String, String> fieldReverseMapping = copyOptions.getReversedMapping();
final Collection<PropDesc> props = BeanUtil.getBeanDesc(actualEditable).getProps();
String fieldName;
Object value;
代码示例来源:origin: looly/hutool
final Map<String, String> fieldReverseMapping = copyOptions.getReversedMapping();
final Collection<PropDesc> props = BeanUtil.getBeanDesc(actualEditable).getProps();
String fieldName;
Object value;
代码示例来源:origin: cn.hutool/hutool-all
/**
* 构造
*
* @param bean Bean
* @param ignoreCase 是否忽略字段大小写
* @param ignoreError 是否忽略字段值读取错误
*/
public BeanValueProvider(Object bean, boolean ignoreCase, boolean ignoreError) {
this.source = bean;
this.ignoreError = ignoreError;
sourcePdMap = BeanUtil.getBeanDesc(source.getClass()).getPropMap(ignoreCase);
}
代码示例来源:origin: cn.hutool/hutool-all
/**
* 获得字段对应值
* @param <T> 属性值类型
* @param fieldName 字段名
* @return 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings("unchecked")
public <T> T get(String fieldName) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
return (T) ((Map<?, ?>)bean).get(fieldName);
}else{
try {
final Method method = BeanUtil.getBeanDesc(beanClass).getGetter(fieldName);
if(null == method){
throw new BeanException("No get method for {}", fieldName);
}
return (T) method.invoke(this.bean);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
代码示例来源:origin: cn.hutool/hutool-all
/**
* 设置字段值
* @param fieldName 字段名
* @param value 字段值
* @throws BeanException 反射获取属性值或字段值导致的异常
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void set(String fieldName, Object value) throws BeanException{
if(Map.class.isAssignableFrom(beanClass)){
((Map)bean).put(fieldName, value);
return;
}else{
try {
final Method setter = BeanUtil.getBeanDesc(beanClass).getSetter(fieldName);
if(null == setter){
throw new BeanException("No set method for {}", fieldName);
}
setter.invoke(this.bean, value);
} catch (Exception e) {
throw new BeanException(e);
}
}
}
代码示例来源:origin: cn.hutool/hutool-all
final Collection<PropDesc> props = BeanUtil.getBeanDesc(bean.getClass()).getProps();
内容来源于网络,如有侵权,请联系作者删除!