当前位置: 首页 > 软件库 > 程序开发 > 常用工具包 >

Mirror DSL

授权协议 未知
开发语言 Java
所属分类 程序开发、 常用工具包
软件类型 开源软件
地区 不详
投 递 者 凌通
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Mirror DSL 是一个用来简化 Java 的反射编程的类库,类似于 BeanUtils

如果直接使用 Java 的反射(Reflection) API,那么代码可能很长,如下:

Field toSet = null;
for (Field f : target.getClass().getDeclaredFields()) {
   
//Get all fields DECLARED inside the target object class
   
if (f.getName().equals("field")) {
       
toSet = f;
   
}
}
if (toSet != null && ((toSet.getModifiers() & Modifier.STATIC) == 0)
       
&& ((toSet.getModifiers() & Modifier.FINAL) == 0)) {
   
toSet.setAccessible(true);
    toSet.set
(target, value);
}


而使用 Mirror DSL 只要短短的一行代码:

ReflectionUtil.setField(target, fielName, value);
  • Engineering Josh Long April 07, 2020 speaker: Josh Long (@starbuxman) Hi, Spring fans! In this installment, we’re going to take a look at the new Kotlin DSL for Spring Integration. I’ve covered both S

  • 转:http://forum.ubuntu.org.cn/viewtopic.php?t=41791 第一次翻译,翻译得不好还请大家见谅,多多指出错误~!:) 原文可以见如下的贴子:http://forum.ubuntu.org.cn/viewtopic.php?t=40082&highlight=%E7%BF%BB%E8%AF%91 使用apt-mirror建立局域网内的Debian/Ubunt

相关阅读

相关文章

相关问答

相关文档