{"id":4535,"date":"2014-03-30T13:18:07","date_gmt":"2014-03-30T13:18:07","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-do-i-bind-different-interfaces-using-google-guice-collection-of-common-programming-errors\/"},"modified":"2014-03-30T13:18:07","modified_gmt":"2014-03-30T13:18:07","slug":"how-do-i-bind-different-interfaces-using-google-guice-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/how-do-i-bind-different-interfaces-using-google-guice-collection-of-common-programming-errors\/","title":{"rendered":"How do I bind Different Interfaces using Google Guice?-Collection of common programming errors"},"content":{"rendered":"<p>Take looks like the Robot Legs section, described in the Guice FAQ. &#8220;How to create a robot with a two Leg objects, the left one injected with a LeftFoot, and the right one with a RightFoot.&#8221; But only one Leg class that&#8217;s reused in both contexts.<\/p>\n<p>There&#8217;s a PrivateModules solution. It uses two separate private modules, a @Left one and an @Right one. Each has a binding for the unannotated Foot.class and Leg.class, and exposes a binding for the annotated Leg.class:<\/p>\n<pre><code>class LegModule extends PrivateModule {\n  private final Class<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Take looks like the Robot Legs section, described in the Guice FAQ. &#8220;How to create a robot with a two Leg objects, the left one injected with a LeftFoot, and the right one with a RightFoot.&#8221; But only one Leg class that&#8217;s reused in both contexts. There&#8217;s a PrivateModules solution. It uses two separate private [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-4535","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4535","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=4535"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/4535\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=4535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=4535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=4535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}