Mica 官方网站

vuePress-theme-reco 如梦技术    2021
Mica 官方网站
文档
组件集
VIP
博文
友情链接
关于
GitHub

如梦技术

0

Article

9

Tag

文档
组件集
VIP
博文
友情链接
关于
GitHub
  • 认识 Mica

    • Mica 简介
    • 快速开始
    • 发行版本
  • mica工具类

    • mica-core模块说明
    • $工具集
    • SystemCode
    • ServiceException
    • Bean-validator分组
    • StringUtil
    • SystemUtil
    • BeanUtil
    • FileUtil
    • JsonUtil
    • UrlUtil
    • WebUtil
    • INetUtil
    • IoUtil
    • NumberUtil
    • ConvertUtil
    • ThreadUtil
    • PathUtil
    • HexUtil
    • AesUtil
    • DesUtil
    • RsaUtil
    • Base64Util
    • DigestUtil
    • DateUtil
    • ObjectUtil
    • ResourceUtil
    • ThreadLocalUtil
    • RuntimeUtil
    • ReflectUtil
    • ClassUtil
    • CollectionUtil
    • Unchecked(Lambda受检异常)
    • Exceptions
    • DecimalNum
    • Once
    • CountMap
    • Version
    • xpath解析xml

vuePress-theme-reco 如梦技术    2021

反射工具类


如梦技术

# 反射工具类

类名: ReflectUtil

# getBeanGetters

/**
 * 获取 Bean 的所有 get方法
 *
 * @param type 类
 * @return PropertyDescriptor数组
 */
ReflectUtil.getBeanGetters(Class type);

# getBeanSetters

/**
 * 获取 Bean 的所有 set方法
 *
 * @param type 类
 * @return PropertyDescriptor数组
 */
ReflectUtil.getBeanSetters(Class type);

# getPropertyDescriptors

/**
 * 获取 Bean 的所有 PropertyDescriptor
 *
 * @param type  类
 * @param read  读取方法
 * @param write 写方法
 * @return PropertyDescriptor数组
 */
ReflectUtil.getPropertyDescriptors(Class type, boolean read, boolean write);

# getProperty

/**
 * 获取 bean 的属性信息
 *
 * @param propertyType 类型
 * @param propertyName 属性名
 * @return {Property}
 */
ReflectUtil.getProperty(Class<?> propertyType, String propertyName);

# getProperty

/**
 * 获取 bean 的属性信息
 *
 * @param propertyType       类型
 * @param propertyDescriptor PropertyDescriptor
 * @param propertyName       属性名
 * @return {Property}
 */
ReflectUtil.getProperty(Class<?> propertyType, PropertyDescriptor propertyDescriptor, String propertyName);

# getTypeDescriptor

/**
 * 获取 bean 的属性信息
 *
 * @param propertyType 类型
 * @param propertyName 属性名
 * @return {Property}
 */
ReflectUtil.getTypeDescriptor(Class<?> propertyType, String propertyName);

# getTypeDescriptor

/**
 * 获取 类属性信息
 *
 * @param propertyType       类型
 * @param propertyDescriptor PropertyDescriptor
 * @param propertyName       属性名
 * @return {Property}
 */
ReflectUtil.getTypeDescriptor(Class<?> propertyType, PropertyDescriptor propertyDescriptor, String propertyName);

# getField

/**
 * 获取 类属性
 *
 * @param clazz     类信息
 * @param fieldName 属性名
 * @return Field
 */
ReflectUtil.getField(Class<?> clazz, String fieldName);

# getAnnotation

/**
 * 获取 所有 field 属性上的注解
 *
 * @param clazz           类
 * @param fieldName       属性名
 * @param annotationClass 注解
 * @param <T>             注解泛型
 * @return 注解
 */
ReflectUtil.getAnnotation(Class<?> clazz, String fieldName, Class<T> annotationClass);

# setField

/**
 * 重写 setField 的方法,用于处理 setAccessible 的问题
 *
 * @param field  Field
 * @param target Object
 * @param value  value
 */
ReflectUtil.setField(Field field, Object target, Object value);

# getField

/**
 * 重写 setField 的方法,用于处理 setAccessible 的问题
 *
 * @param field  Field
 * @param target Object
 * @return value
 */
ReflectUtil.getField(Field field, Object target);

# invokeMethod

/**
 * 重写 invokeMethod 的方法,用于处理 setAccessible 的问题
 *
 * @param method Method
 * @param target Object
 * @return value
 */
ReflectUtil.invokeMethod(Method method, Object target);

# invokeMethod

/**
 * 重写 invokeMethod 的方法,用于处理 setAccessible 的问题
 *
 * @param method Method
 * @param target Object
 * @param args   args
 * @return value
 */
ReflectUtil.invokeMethod(Method method, Object target, Object args);

# 微信 vs 公众号

如梦技术

精彩内容每日推荐!!!

编辑此页面
更新时间: 9/8/2020, 8:42:56 PM
  • getBeanGetters
  • getBeanSetters
  • getPropertyDescriptors
  • getProperty
  • getProperty
  • getTypeDescriptor
  • getTypeDescriptor
  • getField
  • getAnnotation
  • setField
  • getField
  • invokeMethod
  • invokeMethod
  • 微信 vs 公众号