ArcBees/GWTP — pull request #652 by hpehl (2014-12-11 20:33:29+00:00)
Title: Use a custom provider to get the presenter in generated proxies.

This is a proposal to customize the way how the presenter is loaded by the proxy. The motivation therefore are situations where you need to execute code or fetch data from the server **before** the actual presenter lifecycle starts. That is to say it's a proposal to prepend the current presenter lifecyle.

Presenters are loaded from genrated proxy classes using an instance of `IndirectProvider`. The concrete instance depends on the annotation used with the proxy interface:

- `@ProxyStandard` → `StandardProvider

`
- `@ProxyCodeSplit` → `CodeSplitProvider

`
- `@ProxyCodeSplitBundle` → `CodeSplitBundleProvider

`

This PR adds the annotation `@CustomProvider` to specify a custom provider. Just like the existing indirect providers, custom providers should specify a constructor which receives the GIN provider as specifed by the Ginjector. I hope the following code snippet makes it more obvious:

```java
@ProxyCodeSplit
@CustomProvider(SecurityContextProvider.class)
public interface MyProxy extends ProxyPlace {}

...

public class SecurityContextProvider implements IndirectProvider {
private final AsyncProvider provider;

public SecurityContextProvider(AsyncProvider provider) {
this.provider = provider;
}

@Override
public void get(AsyncCallback callback) {
// Fetch data from the server which needs to be at hand
// _before_ the presenter is loaded.
provider.get(callback);
}
}
```

See also the GWTP post at [1]

[1] https://groups.google.com/forum/#!topic/gwt-platform/jAxPQQQ3Jtk