Not sure we support the generics use case for mixins at the moment.
(Certainly you can do it with code style ITDs). For a mixin you'd perhaps
want to ensure it shared a type variable with the target, maybe
public <T> BaseService baseServiceMixin() {
return new BaseServiceImpl<T>();
}
And then the infrastructure would do the necessary wiring, but that is just
with me thinking about it for a few seconds.
cheers,
Andy
On 6 October 2014 08:51, Eric B <[email protected]> wrote:
> Hi,
>
> I've got the following base class that I would like to change to a Mixin
> aspect instead.
>
> abstract public class BaseServiceImpl<T> implements BaseService<T> {
>
> abstract protected BaseRepository<T> getRepo();
>
> public void save(T entity) {
>
> getRepo().save(entity);
>
> }
>
> public List<T> findAll() {
>
> return getRepo().getAll();
>
> }
>
> public T findById(String id) {
>
> return getRepo().get(id);
>
> }
>
> public void deleteEntity(T entity) {
>
> getRepo().remove(entity);
>
> }
>
> }
>
>
> But given the fact that it uses a generic, I'm not quite sure how to
> declare my mixin. I'm looking to do this for a general case for all
> classes in a particular path where each 'T'ype is different, so am not sure
> how to write the declaration
>
>
> @DeclareMixin("com.ia.server.*Impl")
>
> public BaseService baseServiceMixin(){
>
> return new BaseServiceImpl<???? what goes here ????>();
>
> }
>
>
> At the moment, this is an abstract class as I need the child class to
> determine the BaseRepo<T>, but is there a way of getting this info from the
> child class itself? Or at the very least, have it @Inject'ed?
>
>
> Thanks,
>
> Eric
>
> _______________________________________________
> aspectj-users mailing list
> [email protected]
> To change your delivery options, retrieve your password, or unsubscribe
> from this list, visit
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users