Search code examples
gwtrequestfactoryservice-locator

Where do the Locator methods go when using a ServiceLocator?


If I use separate service classes with a ServiceLocator, do I still need to define the Locator methods somewhere?:

T create(Class<? extends T> clazz)
I getId(T domainObject)
T find(Class<? extends T> clazz, I id)
Object getVersion(T domainObject)

Do they go on the service class?


Solution

  • In general, these two types serve orthogonal purposes: A ServiceLocator finds code; a Locator finds entities.

    Using a ServiceLocator does not change where the entity support methods are declared. The entity support methods are still searched for in the domain types.