design patterns - Extend multiple Java classes without duplication -


i have java class can extend either of 2 third-party classes, cannot change. can choose either of these implementations @ compile time no changes class other "extends" declaration. unfortunately need choose implementation use @ runtime, not @ compile time. what's best way select between these 2 implementations @ run-time without duplicating entire derived class?

it sounds require strategy pattern.

the strategy pattern (also known policy pattern) particular software design pattern, whereby algorithms can selected @ runtime.

so java class should contain reference 1 of 2 classes want use, , bridge implementation. implementation choose can selected @ runtime. it's not clear problem description, if 2 3rd-party classes implement common interface, java class implement interface , can directly map referenced 3rd-party class.


Comments

Popular posts from this blog

drupal - using views argument in the view tpl.php file -

php - Posting PHPBB Forum Thread/Post info in a website -

php - Add a blog by sending a mail to a certain emailadress -