Atitit. Class  元数据的反射操作 api apache  工具

1 BeanUtils & PropertyUtils & MethodUtils类使用方法 - 短裤党 ConstructorUtils1

2 New实例 ConstructorUtils.invokeConstructor1

3 调用方法 MethodUtils2

4 参考3

BeanUtils & PropertyUtils & MethodUtils类使用方法 - 短裤党 ConstructorUtils

作者:: 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://www.cnblogs.com/attilax/

New实例 ConstructorUtils.invokeConstructor

private String exe(HttpServletRequest req) {

String meth = req.getParameter("method");

Handler hd = (Handler) mp.get(meth);

if (hd != null) {

try {

return (String) hd.handleReq(req);

} catch (Exception e) {

// TODO Auto-generated catch block

e.printStackTrace();

return e.getMessage();

}

}

if (hd == null) {

String classname = refx.getClassName(meth);

String meth_name = refx.getMethodName(meth);

Object o;

try {

o = ConstructorUtils.invokeConstructor(

Class.forName(classname), null);

MethodUtils.invokeMethod(o, meth_name, null);

} catch (Exception e) {

return core.toJsonStrO88(e);

}

}

return meth;

}

调用方法 MethodUtils

1.      //通过MethodUtils的invokeMethod方法,执行指定的entity中的方法(无参的情况)

2.         System.out.println( MethodUtils.invokeMethod(entity, "haha", null) );

3. 

4.         //通过MethodUtils的invokeMethod方法,执行指定的entity中的方法(1参的情况)

5.         MethodUtils.invokeMethod(entity, "sayHelle", "心梦帆影");

6. 

7.         //通过MethodUtils的invokeMethod方法,执行指定的entity中的方法(多参的情况)

8.         Object[] params = new Object[]{new Integer(10),new Integer(12)};

9.         String msg = (String)MethodUtils.invokeMethod(entity, "countAges", params);

10.         System.out.println(msg);

参考

BeanUtils & PropertyUtils & MethodUtils类使用方法 - 短裤党 - ITeye技术网站.html

Apache Commons BeanUtils包学习(3)-ConstructorUtils.invokeConstructor,MethodUtils.invokeMethod - Anvil的专栏 - 博客频道 - CSDN.NET.html

atitit.java给属性赋值方法总结and BeanUtils 1.6.1 .copyProperty的bug - attilax的专栏 - 博客频道 - CSDN.NET.html

attilax.java 注解的本质and 使用最佳实践(3)O7 - attilax的专栏 - 博客频道 - CSDN.NET.html

Atitit. Class  元数据的反射操作 api apache  工具的更多相关文章

  1. Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理

    Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理 1. reg 工具 这个cli工具接口有,优先使用,jreg的要调用dll了,麻烦的 ...

  2. Atitit.atiInputMethod v2词库清理策略工具    q229

    Atitit.atiInputMethod v2词库清理策略工具    q229 1.1. Foreigncode 外码清理1 1.2. 垃圾词澄清1 1.1. Foreigncode 外码清理 On ...

  3. Api管理工具(spring-rest-docs)

    对于app开发来说,必须需要有相应的api文档,一般最基础的就是用markdown工具来撰写api文档.当对于开发人员来说,是总会想着寻找更方便撰写,测试,对接前端开发的文档生成的工具. 其实这方面的 ...

  4. Atitit.ati  str  字符串增强api

    Atitit.ati  str  字符串增强api 1. java StringUtils方法全览 分类: Java2011-11-30 17:22 8194人阅读 评论(2) 收藏 举报 javas ...

  5. 基于tauri打造的HTTP API客户端工具-CyberAPI

    国庆长假和朋友聚会的时候,和朋友谈起最近这段时间捣鼓tauri,写了一个HTTP API客户端工具.『你写了这么多东西,其实有想过是为了啥不?』为了啥这是一个很大的命题,当初每个项目的时候都想过它应该 ...

  6. Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范

    Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范 简化英文1 常用类库sdk的命名单词统计表1 简化时间规则1 Namsspace nam spec,参照java . ...

  7. Atitit 项目管理(5)----------后勤管理与工具链支持管理

    Atitit 项目管理(5)----------后勤管理与工具链支持管理 1.1. keyword1 1.2. 15个辅助软件1 1.3. 公共模块管理(100个即可)2 1.4. 第三方类库表2 1 ...

  8. FREE 开源 API 管理工具等

    最近学习API 管理工具,发现几个不错的东西,记录如下: 1.IBM 收购NODE 厂家  STRONGLOOP 有一产品LOOPBACK,开源,好! 2.apigee  api管理平台 也不错. 3 ...

  9. Aliexpress API 测试工具

    Aliexpress API 测试工具 上回简单说了 Aliexpress API 的认证流程, 这回在奉送一个小工具, API 测试工具. 点我下载 做这一行,和做程序员的生活完全不搭调, 格格不入 ...

随机推荐

  1. IP地址网段规划

  2. Vue-router路由基础总结(一)

    一.安装 npm下载:npm install vue-router 如果在一个模块化工程中使用它,必须要通过 Vue.use() 明确地安装路由功能:在你的文件夹下的 src 文件夹下的 main.j ...

  3. IntelliJ IDEA 创建 java Maven项目

    1.下载安装Maven 下载官网:http://maven.apache.org/download.cgi 下载解压到当前目录并建立LocalWarehouse文件夹,该文件夹为自己的文件仓库做存储. ...

  4. C# 秒数转日期_由秒数得到日期几天几小时_当前日期时间,转换为秒

    ///<summary> ///由秒数得到日期几天几小时... ///</summary ///<param name="t">秒数</para ...

  5. [CSS3] Make a One-time CSS Animation that Does Not Revert to its Original Style

    We'll add animation to patio11bot using CSS keyframes. When defining a CSS animation, you can add it ...

  6. 使用HTML5画布(canvas)生成阴影效果

    来源:GBin1.com 使用HTML5的画布特性,我们可以创建图形,在这片文章中,我们将创建图形的阴影. var canvas = document.getElementById('shadowca ...

  7. rails执行sidekiq任务的时候报错“can't connect to local mysql server through socket '/var/run/mysqld/mysqld.sock'”

    rails执行sidekiq任务的时候报错“can't connect to local mysql server through socket '/var/run/mysqld/mysqld.soc ...

  8. wamp server php环境绑定域名

    思路: 用花生壳做动态域名解析 用wamp server 在本机上做一个 php web server; 这样就可以让一台内网电脑做一个测试用的服务器: 一:wamp server php环境绑定域名 ...

  9. iOS工程中的info.plist文件的完整研究

    原地址:http://blog.sina.com.cn/s/blog_947c4a9f0100zf41.html 们建立一个工程后,会在Supporting files下面看到一个"工程名- ...

  10. C++ String和其他类型互换

    在C++中如何实现String和其他类型互换呢?最好的方式是使用stringstream,下面简单介绍下: 1.其他类型转换为String #include <sstream> strin ...