View Javadoc

1   package org.shortbrain.vaadin.container;
2   
3   import java.util.Collection;
4   
5   import com.vaadin.data.Container;
6   
7   /**
8    * ContainerFactory interface class that define methods to facilitate the
9    * creation of Containers from a list of objects using different algorithms.
10   * 
11   * @author Vincent Demeester <vincent@demeester.fr>
12   * 
13   * @param <BEAN>
14   *            type of the beans.
15   */
16  public interface IContainerFactory<BEAN> {
17  
18      /**
19       * Return a container of type BEAN from a collection of BEAN objects. It will
20       * update the given container if no null.
21       * 
22       * @param container
23       *            container to be populated.
24       * @param beans
25       *            collection of beans.
26       * @return a container of Beans.
27       * 
28       * @since 0.2.0
29       */
30      public abstract Container getContainerFromCollection(Container container,
31              Collection<BEAN> beans);
32  
33      /**
34       * Return a container of type BEAN from a collection of BEAN objects. It will
35       * update the given container if no null.
36       * 
37       * The returned container will be of the given type (containerClass).
38       * 
39       * @param container
40       *            container to be populated.
41       * @param beans
42       *            collection of beans.
43       * @param containerClass
44       *            type of the container to return.
45       * @return a container of Beans.
46       * 
47       * @since 0.2.0
48       */
49      public abstract Container getContainerFromCollection(Container container,
50              Collection<BEAN> beans, Class<? extends Container> containerClass);
51  
52      /**
53       * Return a container of type BEAN from a collection of BEAN objects.
54       * 
55       * The returned container will be of the given type (containerClass).
56       * 
57       * @param beans
58       *            collection of beans.
59       * @param containerClass
60       *            type of the container to return.
61       * @return a container of Beans.
62       * 
63       * @since 0.2.0
64       */
65      public abstract Container getContainerFromCollection(Collection<BEAN> beans,
66              Class<? extends Container> containerClass);
67  }