RequestFactory several locators for a domain object

16 views
Skip to first unread message

Sydney

unread,
Jul 13, 2011, 11:47:57 PM7/13/11
to google-we...@googlegroups.com
I want to be able to use different locators for the same domain object. I use Twig and it has an option to load an object fully or partially. When I run the lite request, the wrong locator (TwigLocator) is used instead of TwigLiteLocator. My current implementation is:

Proxies

@ProxyFor(value = MyDomain.class, locator = TwigLocator.class)
public interface MyDomainProxy extends EntityProxy {}

@ProxyFor(value = MyDomain.class, locator = TwigLiteLocator.class)
public interface MyDomainLiteProxy extends EntityProxy {}

Request

@Service(value = MyDao.class, locator = DaoServiceLocator.class)
public interface MyRequest extends RequestContext {
    Request<List<MyDomainProxy>> fetchRange(Integer start, Integer length);
    Request<Integer> getCount();
    Request<List<MyDomainLiteProxy>> fetchRangeLite(Integer start, Integer length);
}

DAO

public List<MyDomain> fetchRange(Integer start, Integer length) {
  ...   
}

public List<MyDomain> fetchRangeLite(Integer start, Integer length) {
  ...   
}


Reply all
Reply to author
Forward
0 new messages