Exposing a Builder Class to client code
<p>I am moving my Game to its own package to make it useful in future games.
I Implemented a Builders class as suggested by one of the user here: <a href="http://stackoverflow.com/questions/2376660/interfaces-static-classes-problem">http://stackoverflow.com/questions/2376660/interfaces-static-classes-problem</a></p>

<pre><code>public final class Builders {
    public static Builder&lt;? extends Sprite&gt; newGameObjectBuilder(Point location, int drawable) {
        return new GameObjectImpl.GameObjectBuilder(location, drawable);
    }
}
</code></pre>

<p>The problem now is that the client code cannot use the builder methods (Example below).  I get the following:</p>

<pre><code>"The method onReceiveKey(new Sprite.ReceiveKeys(){}) is undefined for the type Builder&lt;capture#4-of ? extends Sprite&gt;"
</code></pre>

<p>Basically I cannot use any of the methods inside the public static call GameObjectBuilder.</p>

<p><code>onReceiveKey</code> is not working.  Only the <code>build()</code> method of the <code>Builder</code> interface is available.</p>

<pre><code>public static Sprite newSoldier(int x, int y) {
    return  Builders.newGameObjectBuilder(new Point(x,y), R.drawable.soldier)
    .onReceiveKey(new Sprite.ReceiveKeys() {

        @Override
        public void onKeyUp(int keyCode, Sprite self, Room room ) {


        }

        @Override
        public void onKeyDown(int keyCode, Sprite self, Room room ) {
            if(keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
                self.moveY(room, 1, Direction.S); 
            }
            else if(keyCode == KeyEvent.KEYCODE_DPAD_UP){
                self.moveY(room, -1, Direction.N); 
            }
            else if(keyCode == KeyEvent.KEYCODE_DPAD_LEFT){
                self.moveX(room, -1,Direction.W); 
            }
            else if(keyCode == KeyEvent.KEYCODE_DPAD_RIGHT){
                self.moveX(room, 1, Direction.E);
            }
        }
    })
    .build();
}
</code></pre>
