blob: b9d067df6f02741ecf50e18ad63425f3afd62ec9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
public aspect Pr113368 {
private pointcut managedBeanConstruction(ManagedBean bean) :
execution(ManagedBean+.new(..)) && this(bean);
//NPE's on the if pointcut below
private pointcut topLevelManagedBeanConstruction(ManagedBean bean) :
managedBeanConstruction(bean) &&
if(thisJoinPointStaticPart.getSignature().getDeclaringType() == bean.getClass());
after(ManagedBean bean) returning: topLevelManagedBeanConstruction(bean) {
System.out.println("I just constructed " + bean);
}
public static void main(String[] args) {
new ManagedBean("super-bean");
new ManagedSubBean();
}
}
class ManagedBean {
public ManagedBean(String s) {
System.out.println(s);
}
}
class ManagedSubBean extends ManagedBean {
public ManagedSubBean() {
super("sub-bean");
}
}
|