Kind of a long headline, but this is usually a question.
I want to know if you think it is a good idea to do the following.
Instead:
public void buyItem(int itemId, int buyerId) { if (itemId <= 0) { throw new IlleglArgumentException("itemId must be positive"); } if (buyerId <= 0) { throw new IlleglArgumentException("buyerId must be positive"); }
I want to have something like:
@Defensive("isPositive(#itemId, #buyerId)") public void buyItem(int itemId, int buyerId) {
Do you think this is good / terrible / too bizarre / too slow? If you really think this is good, I was thinking about using SpEL to implement it, does anyone have a better / lighter / faster mindset?
Thanks,
java coding-style spring-aop aop
Simeon
source share