blob: acfc27e70c65512eb9fac01c09323710cd335085 (
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
|
package test;
import java.util.ArrayList;
import java.util.List;
public aspect ListFactoryAspect {
private ListFactory listFactory = new ListFactory() {
public <T> List<T> createList() {
return new ArrayList<T>();
};
public <T> List<T> createList(int initialCapacity) {
return new ArrayList<T>();
};
};
declare parents: Processor implements ListFactoryConsumer;
public ListFactory ListFactoryConsumer.getListFactory() {
return ListFactoryAspect.aspectOf().listFactory;
}
public <T> List<T> ListFactoryConsumer.createList() {
return getListFactory().<T>createList();
}
public <T> List<T> ListFactoryConsumer.createList(int initialCapacity) {
return getListFactory().<T>createList(initialCapacity);
}
}
|