Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 377891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:44:25+00:00 2026-05-12T14:44:25+00:00

Has anybody ever seen/attempted to write a service locator pattern which uses a Guice

  • 0

Has anybody ever seen/attempted to write a service locator pattern which uses a Guice style configuration system?

Currently I have a GWT project (which happens to use GWT-RPC) that uses a command pattern wherein my RPC servlet that looks like this…

public interface TransactionService extends RemoteService {

    <T extends Response> T execute(Action<T> action);
}

In my current implementation of the execute method I do this…

if(action instanceof SomeActionImpl){
  doSomeActionImpl((SomeActionImpl)action);
}else if(action instanceof SomeActionImpl2){
  doSomeActionImpl2((SomeActionImpl2)action);
}

What I would like to do is figure out a way to get rid of the giant if statement. I would need some way of registering that ActionImpl1’s class should be delegated to another implementation of TransactioNService.

Any ideas? I was thinking of just adding entries to a HashMap where the key is the Action’s class and the value is the ServiceImpl’s Class. One I have a reference to the ServiceImpl class I could use Guice to get an instance of TransactionService.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:44:25+00:00Added an answer on May 12, 2026 at 2:44 pm

    Take a look at the net.customware.gwt.dispatch.server.DefaultActionHandlerRegistry class in gwt-dispatch (http://code.google.com/p/gwt-dispatch/); it does exactly what you are suggesting. Here is the member variable that stores the handlers:

    private final Map<Class<? extends Action<?>>, ActionHandler<?, ?>> handlers;

    If you want to execute the handlers on the server side, then use the gwt-dispatch server-side components; if it’s client-side stuff, then consider modelling your dispatching class on DefaultActionHandlerRegistry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anybody ever thought about this question. Why we must write $var_name = value;
I was wondering if anybody has ever seen a combination vertical and horizontal jQuery
I was wondering if anybody has ever created some sort of system that can
Has anybody ever had issues with a Java application that uses Jacob to call
Has anybody ever successfully written code to extract data from a SharePoint 2007 list
Has anybody successfully integrated Clearcase with Teamcity (which advertises Clearcase support) to realize a
Has anybody ever tried to change the color of jstree particular node using types
Has anybody here ever used ngen? Where? why? Was there any performance improvement? when
Has anybody here ever managed to do it?
How to implement a real fast web chat with PHP? Has anybody ever wonder

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.