Atitit. Class 元数据的反射操作 api apache 工具
Atitit. Class 元数据的反射操作 api apache 工具
1 BeanUtils & PropertyUtils & MethodUtils类使用方法 - 短裤党 ConstructorUtils1
2 New实例 ConstructorUtils.invokeConstructor1
1 BeanUtils & PropertyUtils & MethodUtils类使用方法 - 短裤党 ConstructorUtils
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://www.cnblogs.com/attilax/
2 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;
}
3 调用方法 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);
4 参考
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 工具的更多相关文章
- Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理
Atitit. 注册表操作查询 修改 api与工具总结 java c# php js python 病毒木马的原理 1. reg 工具 这个cli工具接口有,优先使用,jreg的要调用dll了,麻烦的 ...
- Atitit.atiInputMethod v2词库清理策略工具 q229
Atitit.atiInputMethod v2词库清理策略工具 q229 1.1. Foreigncode 外码清理1 1.2. 垃圾词澄清1 1.1. Foreigncode 外码清理 On ...
- Api管理工具(spring-rest-docs)
对于app开发来说,必须需要有相应的api文档,一般最基础的就是用markdown工具来撰写api文档.当对于开发人员来说,是总会想着寻找更方便撰写,测试,对接前端开发的文档生成的工具. 其实这方面的 ...
- Atitit.ati str 字符串增强api
Atitit.ati str 字符串增强api 1. java StringUtils方法全览 分类: Java2011-11-30 17:22 8194人阅读 评论(2) 收藏 举报 javas ...
- 基于tauri打造的HTTP API客户端工具-CyberAPI
国庆长假和朋友聚会的时候,和朋友谈起最近这段时间捣鼓tauri,写了一个HTTP API客户端工具.『你写了这么多东西,其实有想过是为了啥不?』为了啥这是一个很大的命题,当初每个项目的时候都想过它应该 ...
- Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范
Atitit usrQBF2312 命名空间pkg 以及 api命名 spec规范 简化英文1 常用类库sdk的命名单词统计表1 简化时间规则1 Namsspace nam spec,参照java . ...
- Atitit 项目管理(5)----------后勤管理与工具链支持管理
Atitit 项目管理(5)----------后勤管理与工具链支持管理 1.1. keyword1 1.2. 15个辅助软件1 1.3. 公共模块管理(100个即可)2 1.4. 第三方类库表2 1 ...
- FREE 开源 API 管理工具等
最近学习API 管理工具,发现几个不错的东西,记录如下: 1.IBM 收购NODE 厂家 STRONGLOOP 有一产品LOOPBACK,开源,好! 2.apigee api管理平台 也不错. 3 ...
- Aliexpress API 测试工具
Aliexpress API 测试工具 上回简单说了 Aliexpress API 的认证流程, 这回在奉送一个小工具, API 测试工具. 点我下载 做这一行,和做程序员的生活完全不搭调, 格格不入 ...
随机推荐
- iOS:quartz2D绘图
Quartz-2D:绘图 一.介绍: •Quartz 2D是一个二维图形绘制引擎,支持iOS环境和Mac OS X环境 •Quartz 2D API可以实现许多功能,如基于路径的绘图.透明度.阴影 ...
- android简单的答题游戏
笔者最近开始沦陷于android,从开始入门到现在已经快半个月的时间,于是便写一个较综合,用到了数据库,多线程操作,以及时钟的添加和停止消除,activity之间的动画转换等,适用于初学者学以致用的小 ...
- mac 下 homebrew安装
打开 brew.sh 网址,然后按照说明操作.
- 转: RSA原理 阮一峰的博客
转:http://www.ruanyifeng.com/blog/2013/06/rsa_algorithm_part_one.html 讲的非常细致,易懂.
- elasticsearch java客户端api使用(一)
1.客户端client构建 package com.pz998.app.service.utils; import static org.elasticsearch.common.settings ...
- [Angular] Angular i18n Pluralization Support
// Component: this.coursesTotal = this.course,length <div i18n>{coursesTotal, plural, =0 {No c ...
- java中compareTo和compare方法之比较,集合中对象的比较
前言 转自:http://www.cnblogs.com/yueliming/archive/2013/05/22/3092576.html (这里做了一些小改动) 一直一来对集合中对象的比较方案,有 ...
- Android常用传感器用法一览(3)
Android 开发包标准有8个传感器: Sensor.TYPE_ACCELEROMETER o 加速度计 (X, Y, Z) m/s2 Sensor.TYPE_GYROSCOPE o 陀螺仪 (X, ...
- 重构wm_concat,采用clob做为存储容器
--Type CREATE OR REPLACE TYPE zh_concat_im AUTHID CURRENT_USER AS OBJECT ( CURR_STR clob, STATIC FUN ...
- webDriver API——第10部分Chrome WebDriver
class selenium.webdriver.chrome.webdriver.WebDriver(executable_path='chromedriver', port=0, chrome_o ...