Hello,

I'm a newbie Java developer and I try to use Guice for my game's server. I 
use Netty 3.5 and Guice 3.0. My problem is that I've an interface 
NetworkHandler owned by an interface NetworkClient :

interface NetworkClient {
    @NotNull NetworkSession getSession();

    @NotNull Set<NetworkHandler> getHandlers();
}

interface NetworkHandler {
    void handle(@NotNull NetworkMessage msg); // NetworkMessage is an 
abstract class
}

As you can see it, a NetworkClient has multiple NetworkHandler that should 
use dependency injection. For example :

class AuthenticationHandler implements NetworkHandler {
    private final Repository<User> users;
    private final NetworkClient client;
    
    @Inject AuthenticationHandler(Repository<User> users, @Assisted 
NetworkClient client) {
        this.users = users;
        this.client = client;
    }

    @Override public void handle(@NotNull NetworkMessage message) {
        // [...]
    }
}

Since NetworkClient has multiple NetworkHandler, I'd like to use 
guice-multibindings and use guice-assistedinject to create NetworkHandlers 
depending on NetworkClient. Here is the expected factory interface :

interface NetworkHandlerFactory {
    Set<NetworkHandler> create(NetworkClient client);
}

How can I get this thing done ? Maybe is right under my nose and I haven't 
found it ...

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-guice/-/mDVqcQBQsDYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-guice?hl=en.

Reply via email to