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 测试工具. 点我下载 做这一行,和做程序员的生活完全不搭调, 格格不入 ...
随机推荐
- Migrating Oracle on UNIX to SQL Server on Windows
Appendices Published: April 27, 2005 On This Page Appendix A: SQL Server for Oracle Professionals Ap ...
- jQuery: on()特别的几种用法
jQuery大家肯定用得非常的熟练了,没什么好讲的,今天为什么要写关于on这个事件绑定的API?主要还是因为看了大神的博文:web移动端浮层滚动阻止window窗体滚动JS/CSS处理;其中对于on用 ...
- loadrunner11操作手册
一:操作 或者 增加用户数的方法 一:仅对单个场景增加用户数 二:同时对多个场景增加用户数 第一步: 第二步: 二:脚本编写示例 Action() { int nHttpRetCode; web_re ...
- iOS开发利器-CocoaPods安装和使用教程
新博客http://www.liuchendi.com 开发iOS项目时肯定会用到许多第三方项目,比如说:ASIHttprequest,JSONKit等等,一些类库可能又关联着其他类库,如果超过一定的 ...
- 加速 Android Studio 的编译速度 2.2
Android studio 2.2 当中有一项新的功能:Dex In Process. 这项功能可以动态的加快编译速度,以及提高Instant Run 的效率. 那么怎么来使用这项新功能呢?你只需要 ...
- 封装log4cp p
log4cpp 是参考 log4j 所写的 c++ 版本的写 log 的库.可以在这里下载 http://log4cpp.sourceforge.net/ 我的使用方法是: 1,定义了一个 _ ...
- #!/usr/bin/env在脚本中的作用
在linux的一些脚本,需在开头一行指定脚本的解释程序,如: #!/usr/bin/env bash #!/usr/bin/bash #!/usr/bin/env python 告诉操作系统执行这个 ...
- [转载]《Delphi 版 everything、光速搜索代码》 关于获取文件全路径 GetFullFileName 函数的优化
Delphi 版 everything.光速搜索代码>,文章中关于获取文件全路径的函数:GetFullFileName,有一个地方值得优化. 就是有多个文件,它们可能属于同一个目录. 譬如 Sy ...
- 使用git-svn迁移SVN至GitLab
使用git-svn迁移SVN至GitLab 1.安装git和git-svn 后面的步骤中对git版本有一定要求,通过yum安装的git版本较低,这里进行编译安装 [root@DevTest ~]# y ...
- 在表单里面检查用户名是否存javascript
function CheckUser(fn) { $.get("/Pages/Handler/CheckExistHander.ashx", { "txt_UserNo& ...