📄 handler.java
字号:
/*
* Created on 2007-3-7
* Last modified on 2007-3-8
* Powered by YeQiangWei.com
*/
package com.yeqiangwei.club.service.proxy;
import java.lang.reflect.Method;
import com.yeqiangwei.club.service.security.Permission;
import org.apache.log4j.Logger;
import com.yeqiangwei.util.Validator;
public class Handler implements InvokeHandler {
private static final Logger logger = Logger.getLogger(Handler.class);
private Object object;
private Permission permission;
public Handler(Object obj){
this.object = obj;
}
public Object invoke(Object proxy, Method method, Object[] objs) throws Throwable
{
Object o = null;;
try {
boolean bea = this.getPermission(object).isPermission(o,method,objs);
if(bea){
System.out.println(method.getName());
o = method.invoke(object,objs);
}
}catch(Exception e){
logger.error(e.toString());
}
return o;
}
public Permission getPermission(Object obj) {
if(Validator.isEmpty(permission)){
this.permission = new Permission(obj);
}
return permission;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -