title: Techniques to expose multiple Interfaces (via static creation methods)
body: <p>I am currently working on a project where I am attempting to hide as much detail about a hierarchy I have created as possible. I want to do this to minimize the amount of information the user needs to know about objects (and to control what they can do to the state of the object). In addition, I'm using the pattern to limit what kinds of objects the application can make, and limit it to creation from the factory.</p>
  
  <p>The main issue I am having, however, is that there are a few different kinds of interfaces I would like to expose. Each interface is has additional functionality that I don't believe should be shared, and I would like to keep these interfaces separated. Finally, I don't know what new interfaces may come in the future, but I'd like to try and be ready for them.</p>
  
  <p><code>Weapon</code>:</p>
  
  <pre><code>public interface Weapon extends GameObject {
      Number attack();
  
      boolean addWeaponAttribute(WeaponAttribute attribute);
  }
  </code></pre>
  
  <p><code>Firearm</code>:</p>
  
  <pre><code>public interface Firearm extends Weapon {
      void reload(Number rounds);
  }
  </code></pre>
  
  <p>My question is what would be the best way to have the factory produce objects with different interfaces? Here's what I am thinking "the best would be":</p>
  
  <ol>
  <li>The most clear to the user (it's obvious what they're asking for and what they're getting back)</li>
  <li>The best for future expansion (I am uncertain what new interfaces I will be adding to this system).</li>
  </ol>
  
  <p>Here's what I have been thinking so far:</p>
  
  <h2>Create properly named methods for each interface</h2>
  
  <pre><code>public static Firearm getFirearm(String firearmName) {
      ...
  }
  
  public static Weapon getWeapon(String weaponName) {
      ...
  }
  </code></pre>
  
  <h2>Do the above, but produce the factories in separately named classes</h2>
  
  <pre><code>public class WeaponFactory {
      public static Weapon getWeapon(String weaponName) {
          ...
      }
  }
  
  
  public class FirearmFactory {    
      public static Firearm getFirearm(String firearmName) {
          ...
      }
  }
  </code></pre>
  
  <h2>Something completely different</h2>
  
  <p>I'm open to suggestions, and changes. This is a flexible project, so I can change as much as I want to (in terms of this portion of the project) to make a better result.</p>
  
  <p>Also - As a side note, I was uncertain if this question was too open-ended or not for SO. If I made a mistake posting here, let me know and I'll move my question elsewhere.</p>