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 测试工具. 点我下载 做这一行,和做程序员的生活完全不搭调, 格格不入 ...
随机推荐
- 诡异的 "密码取回" 邮件问题
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- Netty游戏服务器之五Unity3d登陆消息
今天我们来讲客户端Unity和服务器收发消息的具体过程. 首先,我们要在unity上搭建登陆界面的UI,这里呢,我用的是NGUI插件. 相信做过unity3d前端的都对这个非常的熟悉,最近官方的UGU ...
- VMware(bridge、NAT、host-only、custom)含义
摘自: http://www.liangston.com/?post=48 VMware(bridge.NAT.host-only.custom)含义 作者:LiangSton 发布于:2012-1- ...
- 用好Git 和 SVN,轻松驾驭版本管理
用好Git 和 SVN,轻松驾驭版本管理 本文从 Git 与 SVN 的对比入手,介绍如何通过 Git-SVN 开始使用 Git,并总结平时工作高频率使用到的 Git 常用命令. 一.Git vs S ...
- 转:关于Android机型适配这件小事儿
http://www.umindex.com/devices/android_resolutions 大家都知道Android机型分裂严重,在开发Android App的时候永远都面临适配N多机型的问 ...
- 怎样删除Weblogic Domain?
转自:http://blog.csdn.net/biplusplus/article/details/7433558 旁白 由于没有现成的配置工具可以做这件事,我们需要手工来删除. 正题 以下方法适用 ...
- [LeetCode][Java] Substring with Concatenation of All Words
题目: You are given a string, s, and a list of words, words, that are all of the same length. Find all ...
- Guava缓存使用
public class GuavaCache { /** * LoadingCache当缓冲中不存在时,可自动加载 * */ private static LoadingCache<Integ ...
- winlogon.exe应用程序错误怎么办
winlogon.exe应用程序错误 求解决办法,重装,还原一定能解决就不要说了,我要其他办法 最佳答案 winlogon.exe 是控制你的系统登陆的程序,是系统绝对核心进程,用来管理系统用户登陆! ...
- M.U.G.E.N Error怎么办
当运行乱舞格斗2008的时候出现以下错误. 在任务管理器中找到M.U.G.E.N.exe这个进程,右击设置相关性,然后取消勾选其中一个,点击确定. 不要关闭这个窗口,否则M.U.G.E.N这个进程也将 ...