lundi 13 juillet 2015

Extending the unextendable: Is it better to use reflection hacks or copy/paste the base class?

An open source library has an abstract Java class I am extending called AbstractDialog. It has a private inner class A and a private member A a that it instantiates in the constructor. Unfortunately, I need to customize the behavior implemented in A.

Should I use reflection to set the a member variable to my own implementation? Or copy the source code for AbstractDialog into my project and make A and a protected?


General answers are best, but in my specific case I want to override the behavior of ContentProvider in the abstract class FilteredItemsSelectionDialog for an Eclipse plugin I am developing.





Aucun commentaire:

Enregistrer un commentaire