[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Don't completely understand the preinitialization pointcut

Hi everyone,

Sorry if this has been asked before, I've searched the faq/cookbook/my previous stored mailings and I'm getting nowhere in understanding the reason for the preinitialization pointcut. Ok, I understand that it doesn't pick join points in the constructor execution, and it doesn't have a this object initialized similar to the call(* new(..)).

I believe that like the initialization pointcut it checks that a constructor is indeed being specified at compile/weave time? So that's one advantage over the call(* new(..)) But with the call(* new(..)) I can at least take control of the object instantiated (as used before in providing test harnesses etc). But I don't have a useful case for when I'd use the preinitialization pointcut, apart from the added degree of safety perhaps with the check that it is indeed a constructor being specified when i don't need to override the constructor at all.

Or is that the best example. When I need to pick join points around a classes instantiation, don't need to override anything, don't want to weave into the class itself (as would occur with initialization) and want to have some compile time checks that I am indeed specifying a constructor.

Basically, are my assumptions correct in the first place and does anyone else have a better use for preinitialization?

Cheers,

Russ Miles