Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Can an around advice for a constructor return a different Class of object?

I have a framework that I would like to use, that generates a bunch of
ArrayList objects, what I would like to do is to trap the constructor calls
and replace the ArrayList with another type of List.  Is this possible?
Basically, I want to create a ListFactory by using aspects.

This is what I have currently:
Object around(int capacity): call(!NSArray+ && List+.new(int)) &&
within(org.objectstyle..*) && args(capacity){
        return new
NSMutableArray(capacity);
    }


However, I am getting a ClassCastException.  The NSMutableArray implements
the List interface.

Thanks for any help.
-- 
Garry Watkins

Database Administrator
Motley Rice LLC
843-216-9639






Confidential & Privileged

Unless otherwise indicated or obvious from its nature, the information contained in this communication is attorney-client privileged and confidential information/work product. This communication is intended for the use of the individual or entity named above.  If the reader of this communication is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error or are not sure whether it is privileged, please immediately notify us by return e-mail and destroy any copies--electronic, paper or otherwise--which you may have of this communication.





Back to the top