开发者

AspectJ join point with simple types

开发者 https://www.devze.com 2023-01-01 04:48 出处:网络
Are there defined join 开发者_如何学Pythonpoints in arithmetics that I can catch? Something like:

Are there defined join 开发者_如何学Pythonpoints in arithmetics that I can catch?

Something like:

int a = 4;
int b = 2;
int c = a + b;

Can I make a pointcut that catches any one of those lines? And what context will I be able to get?

I would like to add a before() to all int/float/double manipulation done in a particular method on a class, is that possible.

I see in the AspectJ docs that there are defined join points for object initialization and method calls. Is declaring an int an object initialization and does the + operator count as a method call?

Thanks!


No, + does not correspond to a method call of any kind in Java.

You could for instance create your own wrapper-class that encapsulates an integer, or use BigInteger and do a pointcut on the add method.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号