PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/gwtrpccommlayer/src/main/java/com/googlecode/gwtrpccommlayer/client/GwtRpcService.java

https://code.google.com/p/gwtrpccommlayer/
Java | 43 lines | 18 code | 8 blank | 17 comment | 0 complexity | 91a3b66a1202bd256418bf90906d2f29 MD5 | raw file
 1package com.googlecode.gwtrpccommlayer.client;
 2
 3import com.google.inject.Guice;
 4import org.apache.http.cookie.Cookie;
 5
 6import java.net.URL;
 7import java.util.Collection;
 8
 9/**
10 *
11 * Meant to accept Service Interface Classes and return an implementation.
12 *
13 * Created by IntelliJ IDEA.
14 * User: dan
15 * Date: 10/30/10
16 * Time: 2:52 PM
17 */
18public interface GwtRpcService {
19
20    public interface Factory {
21        GwtRpcService newInstance();
22    }
23
24    public static final Factory FACTORY = new Factory() {
25        @Override
26        public GwtRpcService newInstance() {
27            return Guice.createInjector(new Module()).getInstance(GwtRpcService.class);
28        }
29    };
30
31    /**
32     * This weakly specified generic T kinda sucks because the "async" GWT interface is not identified by anything.
33     *
34     * @param url
35     * @param serviceClass
36     * @param <T>
37     * @return
38     */
39    <T> T create(URL url, Class<T> serviceClass);
40
41    <T> T create(URL url, Class<T> serviceClass, Collection<Cookie> cookies);
42
43}