I am using GWT in my application. For caching pictures i use ClientBundle with ImageResource. I have many ClientBundles like this:
public interface MenuBundle extends ClientBundle {
@Source(background.png)
ImageResource background();
@Source(image_bg.png)
ImageResource image_bg();
...
}
and hundreds ClientBundles with same methods like this:
public interface House1 extends House, ClientBundle {
@Source(house1/pic1.png)
ImageResource pic1();
@Source(house1/pic2.png)
ImageResource pic2();
@Source(house1/pic3.png)
ImageResource pic3();
...
}
public interface House2 extends House, ClientBundle{
@Source(house2/pic1.png)
ImageResource pic1();
@Source(house2/pic2.png)
ImageResource pic2();
@Source(house2/pic3.png)
ImageResource pic3();
...
}
public interface House {
ImageResource pic1();
ImageResource pic2();
ImageResource pic3();
...
}
In result i have hundreds pictures on server like "*.cache.png". For fast loading i need less pictures. For this purpose i found decision:
public class ClientBundleModule extends AbstractGinModule {
@Override
protected void configure() {
bind(MenuBundle.class).to(ClientBundlePack1.class);
bind(NatureFuture.class).to(ClientBundlePack1.class);
...
bind(House1.class).to(ClientBundlePack2.class);
bind(House2.class).to(ClientBundlePack2.class);
bind(House3.class).to(ClientBundlePack2.class);
...
}
}
public interface ClientBundlePack1 extends MenuBundle, NatureFuture, ... {
}
public interface ClientBundlePack2 extends House1, House2, House3, ... {
}
Also there is Ginjector, ... But problem is :
MenuBundle, NatureFuture and other classes in ClientBundlePack1 compile in one big picture (it's good), but House1, House2, House3 and other Houses do not compile in one big picture (it's bad).
Houses compile each class House in one picture. I see problem in java way to extends implementation, to use just one same method like pic1 instead use all methods pic1.
But i need to join all Houses in one picture. There is setting, annotation for GIN to do that. Or may be is there other way for join all Houses? But i cannot rewrite code of Houses, it will break architecture of my application. I need all houses immediately after preloading, without "Lazy loading".
Thanks.