[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] Question about using within/cflow pointcutswiththird-party jars
|
Thanks Ron - a couple followup questions below:
> To weave within the hibernate classes, you would need
> Hibernate to be on your inpath (i.e., to weave the Hibernate
> jars). One way you might do this without building a modified
> version of Hibernate would be load-time weaving.
I've been assuming LTW is expensive - is it not? I think I'll give it a
go, since I don't want to modify Hibernate unless I have to.
> Another option would be to use cflow of calls into Hibernate.
> The calls from your code into Hibernate can be woven without
> weaving into Hibernate. E.g.,
>
> pointcut callHibernate():
> call(* org.hibernate..*(..)) ||
> call(org.hibernate..*.new(..));
> pointcut inHibernate(): cflow(callHibernate());
>
> pointcut setterNotCalledByHibernate():
> !calledByHibernate() && execution(* *.set*(..));
Right; the issue is that I need to exclude Hibernate joinpoints
regardless of where they're called from - it's not always from "my
code".
> Also, note that your original pointcut is rather expensive
> (it would weave into *all join points* in Hibernate such as
> field get/set, handler etc). If you were going to weave into
> Hibernate you'd want something like:
>
> pointcut hibernate():
> (execution(* *(..)) || execution(* new(..))) &&
> within(org.hibernate..*);
Thanks, I was a bit method-invocation-myopic there for a moment - didn't
consider the other joinpoint types. :-)
Dumb question (?): Why "execution(* new(..))" in the pointcut
immediately above - isn't this covered by "execution(* *(..))"?
Cheers,
Neil