centos中无线网卡的安装及配置
2013-12-26 18:03
351 查看
/*
* 模拟实现ognl表达式
*/
public class MyOgnlValue {
// =========用迭代的方式解决多参数问题========================//
public static Object getValue(String exp, MyContext root) throws Exception {
if (exp == null || exp.length() == 0) {
throw new Exception("表达式为空!");
}
String[] express = exp.split("\\.");
if (express.length == 1) {
return root.get(express);
} else {
Object o = root.get(express[0]);
int i = 1;
while (express.length != i) {
o=getValue(express[i], o);
i++;
}
return o;
}
}
public static Object getValue(String exp, Object o) throws Exception {
String md="";
Object obj=null;
if(exp.indexOf("[")>0)
{
md="get"+exp.substring(0,1).toUpperCase()+exp.substring(1,exp.indexOf("["));
Method method=o.getClass().getMethod(md, new Class[]{});
obj= method.invoke(o, new Object[]{});
if(obj instanceof List)
{
int j=Integer.parseInt(exp.substring(exp.indexOf("[")+1,exp.indexOf("]")));
return ((List) obj).get(j);
}
else if(obj instanceof Map)
{
String key=exp.split("\'")[1];
return ((Map) obj).get(key);
}
else if(obj.getClass().getName().indexOf("[L")==0 || obj.getClass().isArray())
{
int j=Integer.parseInt(exp.substring(exp.indexOf("[")+1,exp.indexOf("]")));
return Array.get(obj, j);
}
}
else
{
md="get"+exp.substring(0,1).toUpperCase()+exp.substring(1);
Method method=o.getClass().getMethod(md, new Class[]{});
obj=method.invoke(o, new Object[]{});
return obj;
}
return obj;
}
}
* 模拟实现ognl表达式
*/
public class MyOgnlValue {
// =========用迭代的方式解决多参数问题========================//
public static Object getValue(String exp, MyContext root) throws Exception {
if (exp == null || exp.length() == 0) {
throw new Exception("表达式为空!");
}
String[] express = exp.split("\\.");
if (express.length == 1) {
return root.get(express);
} else {
Object o = root.get(express[0]);
int i = 1;
while (express.length != i) {
o=getValue(express[i], o);
i++;
}
return o;
}
}
public static Object getValue(String exp, Object o) throws Exception {
String md="";
Object obj=null;
if(exp.indexOf("[")>0)
{
md="get"+exp.substring(0,1).toUpperCase()+exp.substring(1,exp.indexOf("["));
Method method=o.getClass().getMethod(md, new Class[]{});
obj= method.invoke(o, new Object[]{});
if(obj instanceof List)
{
int j=Integer.parseInt(exp.substring(exp.indexOf("[")+1,exp.indexOf("]")));
return ((List) obj).get(j);
}
else if(obj instanceof Map)
{
String key=exp.split("\'")[1];
return ((Map) obj).get(key);
}
else if(obj.getClass().getName().indexOf("[L")==0 || obj.getClass().isArray())
{
int j=Integer.parseInt(exp.substring(exp.indexOf("[")+1,exp.indexOf("]")));
return Array.get(obj, j);
}
}
else
{
md="get"+exp.substring(0,1).toUpperCase()+exp.substring(1);
Method method=o.getClass().getMethod(md, new Class[]{});
obj=method.invoke(o, new Object[]{});
return obj;
}
return obj;
}
}
相关文章推荐
- ThinkPad E520下CentOS 6.2配置指南 --安装无线网卡RTL8188CE驱动、ATI6630显卡驱动、配置更新源、挂载NTFS
- centos7 无线网卡驱动的安装及无线网络的配置详解
- 教学系列CentOS安装和配置无线网卡
- Centos下无线网卡的安装配置
- (X)CentOS下无线网卡的安装与配置(虚拟机下)
- ThinkPad E520下CentOS 6.2配置指南 --安装无线网卡RTL8188CE驱动、ATI6630显卡驱动、配置更新源、挂载NTFS
- CentOS 安装无线网卡驱动,配置无线上网
- centOS 无线网卡驱动 安装 配置
- centOS 无线网卡驱动 安装 配置
- CentOS 6.6下 BCM4312 802.11b/g无线网卡驱动安装
- CentOS 6.4 安装D-Link 525(RT5360)无线网卡驱动
- CentOS下安装无线网卡驱动 (转)
- 详解CentOS 6.5如何安装Realtek无线网卡驱动
- CentOS下安装无线网卡驱动
- Centos 7 联想Y430P无线网卡驱动安装 过程参考
- VMware安装centos7,装机前配置双网卡,装机后只显示单网卡信息
- centos infiniband网卡安装配置
- CentOS-无线网卡配置使用
- CentOS 7安装broadcom无线网卡驱动
- vm 安装centos 7无网卡配置文件解决方法