title: Extend multiple Java classes without duplication
body: <p>I have a Java class that can extend either of two third-party classes, which I cannot change.  I can choose either of these implementations at compile time with no changes to my class other than the "extends" declaration.  Unfortunately I need to choose which implementation to use at runtime, not at compile time.  What's the best way to select between these two implementations at run-time without duplicating the entire derived class?</p>