com.gwtplatform.common.client
Class ProviderBundle

java.lang.Object
  extended by com.gwtplatform.common.client.ProviderBundle

public class ProviderBundle
extends Object

This class can be used to contain a group of providers that should all sit behind the same split point. That is, if the code for one provided object is loaded, so is the code for the others. This is useful when the provided objects share the bulk of their code, which would end up in the left-overs if the objects were behind their individual split points.

Here is an example use of ProviderBundle:

 public class MyPresenterBundle extends ProviderBundle {
   public final static int ID_Object1 = 0;
   public final static int ID_Object2 = 1;
   public final static int BUNDLE_SIZE = 2;

   @Inject
   MyPresenterBundle(
       final Provider object1Provider,
       final Provider object2Provider) {
     super( BUNDLE_SIZE );
     providers[ID_Object1] = object1Provider;
     providers[ID_Object2] = object2Provider;
   }
 }

Author:
Philippe Beaudoin

Field Summary
protected  Provider<?>[] providers
           
 
Constructor Summary
ProviderBundle(int bundleSize)
          Constructs a ProviderBundle containing a given number of providers.
 
Method Summary
 Provider<?> get(int providerId)
          Accesses a provider given its id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

providers

protected final Provider<?>[] providers
Constructor Detail

ProviderBundle

public ProviderBundle(int bundleSize)
Constructs a ProviderBundle containing a given number of providers. After calling this constructor you should set the provider manually like so:
     providers[0] = object1Provider;
     providers[1] = object2Provider;
     ...
     providers[bundleSize-1] = objectNProvider;

Parameters:
bundleSize - The number of providers in the bundle.
Method Detail

get

public Provider<?> get(int providerId)
Accesses a provider given its id.

Parameters:
providerId - The id of the provider to access.
Returns:
The provider.


Copyright © 2010-2011 ArcBees. All Rights Reserved.