I want my class to implement an interface, but I want to provide method implementation using ITD in one aspect. Is it possible?
Interface:
public interface CloningService<T> { public T clone(T object); }
The default implementation is:
public class DefaultCloningServiceImpl implements CloningService<T> { public T clone(T object) {
Specific implementation:
public class PersonService implements CloningService<Person> {
The PersonService class will declare that it implements the CloningService interface, but the actual implementation of the methods will be provided in DefaultCloningServiceImpl, and the aspect will introduce them to the PersonService.
I followed the example on Eclipse.com and I tried using @DeclareParents to achieve the above functionality. However, I was getting a compiler error from AspectJ that was related to generics. As if the @DeclareParents annotation did not expect the use of generics ...
Thanks.
source share