中国开发网: 论坛: 程序员情感CBD: 贴子 158422
furnace
看我写的代码,嘎嘎。。。有bug哦
public aspect UserPermisionCheckAspect
{
// pointcut, for calling the User.changeSystemConfiguration
pointcut callChangeSystem(User user_, Computer x): call ( * User.changeSystemConfiguration(Computer) )
&& target(user_) && args(x);

void around(User user_, Computer x)
throws InsufficientPermissionException :
callChangeSystem(user_, x)
{
String username = user_.getName();
//System.out.println("Username: " + username + ". computer: " + x.getName());
if (!user_.getName().equals("Administrator"))
{
throw new InsufficientPermissionException("The user: " + user_.getName() +" have no permission to change the system.");
}
// continue the process.
proceed(user_, x);
}
}
I don't mind if you r FAT.
I don't mind if you r UGLY.
I don't mind if you ACT CUTE.
But I can't STAND if you r FAT, UGLY and still ACT CUTE.

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录