View Javadoc

1   /*
2    * Copyright 2012 Vincent Demeester<vincent+shortbrain@demeester.fr>.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    * 
7    * http://www.apache.org/licenses/LICENSE-2.0
8    * 
9    * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11   * and limitations under the License.
12   */
13  package org.shortbrain.vaadin.container;
14  
15  import java.util.Collection;
16  
17  import org.shortbrain.vaadin.container.annotation.ContainerType;
18  import org.shortbrain.vaadin.container.property.AnnotationReaderAlgorithm;
19  import org.shortbrain.vaadin.container.property.HierarchicalBeanBuilder;
20  import org.shortbrain.vaadin.container.property.PropertyReaderAlgorithm;
21  
22  import com.vaadin.data.Container;
23  import com.vaadin.data.Container.Hierarchical;
24  import com.vaadin.data.util.AbstractBeanContainer;
25  import com.vaadin.data.util.AbstractBeanContainer.BeanIdResolver;
26  import com.vaadin.data.util.HierarchicalBeanContainer;
27  import com.vaadin.data.util.HierarchicalBeanItemContainer;
28  
29  /**
30   * ContainerFactory abstract class that define methods to facilitate the creation of Containers from a list of objects using different
31   * algorithms.
32   * 
33   * This Factory returns Container that are {@link com.vaadin.data.util.AbstractBeanContainer} implementation.
34   * 
35   * @author Vincent Demeester <vincent@shortbrain.org>
36   * 
37   * @param <IDTYPE>
38   *            The type of the item identifier
39   * @param <BEANTYPE>
40   *            The type of the Bean
41   * @since 0.2.0
42   * 
43   * @see ContainerFactory
44   * @see com.vaadin.data.util.BeanContainer
45   * @see com.vaadin.data.util.AbstractBeanContainer
46   */
47  public abstract class HierarchicalBeanContainerFactory<IDTYPE, BEANTYPE> implements IContainerFactory<BEANTYPE> {
48  
49      /**
50       * Return a container of type BEAN from a collection of BEAN objects. It will update the given container if no null.
51       * 
52       * @param container
53       *            container to be populated.
54       * @param beans
55       *            collection of beans.
56       * @return a container of Beans.
57       * 
58       * @since 0.2.0
59       */
60      public abstract Container getContainerFromCollection(Container container, Collection<BEANTYPE> beans);
61  
62      /**
63       * Return a container of type BEAN from a collection of BEAN objects. It will update the given container if no null.
64       * 
65       * The returned container will be of the given type (containerClass).
66       * 
67       * @param container
68       *            container to be populated.
69       * @param beans
70       *            collection of beans.
71       * @param containerClass
72       *            type of the container to return.
73       * @return a container of Beans.
74       * 
75       * @since 0.2.0
76       */
77      public abstract Container getContainerFromCollection(Container container, Collection<BEANTYPE> beans,
78              Class<? extends Container> containerClass);
79  
80      /**
81       * Return a container of type BEAN from a collection of BEAN objects.
82       * 
83       * The returned container will be of the given type (containerClass).
84       * 
85       * @param beans
86       *            collection of beans.
87       * @param containerClass
88       *            type of the container to return.
89       * @return a container of Beans.
90       * 
91       * @since 0.2.0
92       */
93      public abstract Container getContainerFromCollection(Collection<BEANTYPE> beans,
94              Class<? extends Container> containerClass);
95  
96      /**
97       * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the propertyId bean id
98       * resolver. It uses {@link BeanItemContainer} implementation by default.
99       * 
100      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
101      * 
102      * @param beanClass
103      *            type of the container.
104      * @param containerType
105      *            type of container (used by AnnotationReaderAlgorithm)
106      * @return a BeanContainerFactory.
107      * 
108      * @since 0.2.0
109      */
110     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
111             A containerType) {
112         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), HierarchicalBeanItemContainer.class, null,
113                 (BeanIdResolver<I, T>) null);
114     }
115 
116     /**
117      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the propertyId bean id
118      * resolver. It uses {@link BeanItemContainer} implementation by default.
119      * 
120      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
121      * 
122      * @param beanClass
123      *            type of the container.
124      * @param containerType
125      *            type of container (used by AnnotationReaderAlgorithm)
126      * @param beanBuilder
127      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
128      * @return a BeanContainerFactory.
129      * 
130      * @since 0.2.0
131      */
132     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
133             A containerType, HierarchicalBeanBuilder<I, T> beanBuilder) {
134         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), HierarchicalBeanItemContainer.class,
135                 beanBuilder, (BeanIdResolver<I, T>) null);
136     }
137 
138     /**
139      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the propertyId bean id
140      * resolver. It uses {@link BeanContainer} implemantation by default.
141      * 
142      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, String)
143      * 
144      * @param beanClass
145      *            type of the container.
146      * @param containerType
147      *            type of container (used by AnnotationReaderAlgorithm)
148      * @param propertyId
149      *            the identifier of the property to use to find item identifiers.
150      * @return a BeanContainerFactory.
151      * 
152      * @since 0.2.0
153      */
154     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
155             A containerType, String propertyId) {
156         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), HierarchicalBeanContainer.class, null,
157                 propertyId);
158     }
159 
160     /**
161      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the propertyId bean id
162      * resolver. It uses {@link BeanContainer} implemantation by default.
163      * 
164      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, String)
165      * 
166      * @param beanClass
167      *            type of the container.
168      * @param containerType
169      *            type of container (used by AnnotationReaderAlgorithm)
170      * @param beanBuilder
171      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
172      * @param propertyId
173      *            the identifier of the property to use to find item identifiers.
174      * @return a BeanContainerFactory.
175      * 
176      * @since 0.2.0
177      */
178     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
179             A containerType, HierarchicalBeanBuilder<I, T> beanBuilder, String propertyId) {
180         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), HierarchicalBeanContainer.class,
181                 beanBuilder, propertyId);
182     }
183 
184     /**
185      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the bean id resolver. It
186      * uses {@link BeanContainer} implemantation by default.
187      * 
188      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
189      * 
190      * @param beanClass
191      *            type of the container.
192      * @param containerType
193      *            type of container (used by AnnotationReaderAlgorithm)
194      * @param beanIdResolver
195      *            the beanIdResolver to use to find item identifiers.
196      * @return a BeanContainerFactory.
197      * 
198      * @since 0.2.0
199      */
200     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
201             A containerType, BeanIdResolver<I, T> beanIdResolver) {
202         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), HierarchicalBeanContainer.class, null,
203                 beanIdResolver);
204     }
205 
206     /**
207      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the bean id resolver. It
208      * uses {@link BeanContainer} implemantation by default.
209      * 
210      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
211      * 
212      * @param beanClass
213      *            type of the container.
214      * @param containerType
215      *            type of container (used by AnnotationReaderAlgorithm)
216      * @param beanIdResolver
217      *            the beanIdResolver to use to find item identifiers.
218      * @param beanBuilder
219      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
220      * @return a BeanContainerFactory.
221      * 
222      * @since 0.2.0
223      */
224     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
225             A containerType, HierarchicalBeanBuilder<I, T> beanBuilder, BeanIdResolver<I, T> beanIdResolver) {
226         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), HierarchicalBeanContainer.class,
227                 beanBuilder, beanIdResolver);
228     }
229 
230     /**
231      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the propertyId bean id
232      * resolver.
233      * 
234      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, String)
235      * 
236      * @param beanClass
237      *            type of the container.
238      * @param containerType
239      *            type of container (used by AnnotationReaderAlgorithm)
240      * @param beanContainerType
241      *            the type of {@link AbstractBeanContainer} to use.
242      * @param propertyId
243      *            the identifier of the property to use to find item identifiers.
244      * @return a BeanContainerFactory.
245      * 
246      * @since 0.2.0
247      */
248     @SuppressWarnings("rawtypes")
249     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
250             A containerType, Class<? extends AbstractBeanContainer> beanContainerType, String propertyId) {
251         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), beanContainerType, null,
252                 propertyId);
253     }
254 
255     /**
256      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the propertyId bean id
257      * resolver.
258      * 
259      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, String)
260      * 
261      * @param beanClass
262      *            type of the container.
263      * @param containerType
264      *            type of container (used by AnnotationReaderAlgorithm)
265      * @param beanContainerType
266      *            the type of {@link AbstractBeanContainer} to use.
267      * @param beanBuilder
268      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
269      * @param propertyId
270      *            the identifier of the property to use to find item identifiers.
271      * @return a BeanContainerFactory.
272      * 
273      * @since 0.2.0
274      */
275     @SuppressWarnings("rawtypes")
276     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
277             A containerType, Class<? extends AbstractBeanContainer> beanContainerType,
278             HierarchicalBeanBuilder<I, T> beanBuilder, String propertyId) {
279         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), beanContainerType, beanBuilder,
280                 propertyId);
281     }
282 
283     /**
284      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the bean id resolver.
285      * 
286      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
287      * 
288      * @param beanClass
289      *            type of the container.
290      * @param containerType
291      *            type of container (used by AnnotationReaderAlgorithm)
292      * @param beanContainerType
293      *            the type of {@link AbstractBeanContainer} to use.
294      * @param beanIdResolver
295      *            the beanIdResolver to use to find item identifiers.
296      * @return a BeanContainerFactory.
297      * 
298      * @since 0.2.0
299      */
300     @SuppressWarnings("rawtypes")
301     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
302             A containerType, Class<? extends AbstractBeanContainer> beanContainerType,
303             BeanIdResolver<I, T> beanIdResolver) {
304         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), beanContainerType, null,
305                 beanIdResolver);
306     }
307 
308     /**
309      * Create a BeanContainerFactory of type T and idtype I using a default {@link AnnotationReaderAlgorithm} and the bean id resolver.
310      * 
311      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
312      * 
313      * @param beanClass
314      *            type of the container.
315      * @param containerType
316      *            type of container (used by AnnotationReaderAlgorithm)
317      * @param beanContainerType
318      *            the type of {@link AbstractBeanContainer} to use.
319      * @param beanBuilder
320      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
321      * @param beanIdResolver
322      *            the beanIdResolver to use to find item identifiers.
323      * @return a BeanContainerFactory.
324      * 
325      * @since 0.2.0
326      */
327     @SuppressWarnings("rawtypes")
328     public final static <I, T, A extends Enum> HierarchicalBeanContainerFactory<I, T> getByAnnotation(Class<? super T> beanClass,
329             A containerType, Class<? extends AbstractBeanContainer> beanContainerType,
330             HierarchicalBeanBuilder<I, T> beanBuilder, BeanIdResolver<I, T> beanIdResolver) {
331         return getByAlgorithm(beanClass, new AnnotationReaderAlgorithm<A>(containerType), beanContainerType, beanBuilder,
332                 beanIdResolver);
333     }
334 
335     /**
336      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
337      * {@link BeanItemContainer} implementation by default.
338      * 
339      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
340      * 
341      * @param beanClass
342      *            type of the container.
343      * @return a BeanContainerFactory.
344      * 
345      * @since 0.2.0
346      */
347     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass) {
348         return getByAlgorithm(beanClass, null, HierarchicalBeanItemContainer.class, null, (BeanIdResolver<I, T>) null);
349     }
350 
351     /**
352      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
353      * {@link BeanItemContainer} implementation by default.
354      * 
355      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
356      * 
357      * @param beanClass
358      *            type of the container.
359      * @param beanBuilder
360      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
361      * @return a BeanContainerFactory.
362      * 
363      * @since 0.2.0
364      */
365     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
366             HierarchicalBeanBuilder<I, T> beanBuilder) {
367         return getByAlgorithm(beanClass, null, HierarchicalBeanItemContainer.class, beanBuilder, (BeanIdResolver<I, T>) null);
368     }
369 
370     /**
371      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
372      * {@link BeanContainer} implementation by default.
373      * 
374      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
375      * 
376      * @param beanClass
377      *            type of the container.
378      * @param beanIdResolver
379      *            the beanIdResolver to use to find item identifiers.
380      * @return a BeanContainerFactory.
381      * 
382      * @since 0.2.0
383      */
384     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
385             BeanIdResolver<I, T> beanIdResolver) {
386         return getByAlgorithm(beanClass, null, HierarchicalBeanContainer.class, null, beanIdResolver);
387     }
388 
389     /**
390      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
391      * {@link BeanContainer} implementation by default.
392      * 
393      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
394      * 
395      * @param beanClass
396      *            type of the container.
397      * @param beanBuilder
398      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
399      * @param beanIdResolver
400      *            the beanIdResolver to use to find item identifiers.
401      * @return a BeanContainerFactory.
402      * 
403      * @since 0.2.0
404      */
405     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
406             HierarchicalBeanBuilder<I, T> beanBuilder, BeanIdResolver<I, T> beanIdResolver) {
407         return getByAlgorithm(beanClass, null, HierarchicalBeanContainer.class, beanBuilder, beanIdResolver);
408     }
409 
410     /**
411      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
412      * {@link BeanContainer} implementation by default.
413      * 
414      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
415      * 
416      * @param beanClass
417      *            type of the container.
418      * @param propertyId
419      *            the identifier of the property to use to find item identifiers.
420      * @return a BeanContainerFactory.
421      * 
422      * @since 0.2.0
423      */
424     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass, String propertyId) {
425         return getByAlgorithm(beanClass, null, HierarchicalBeanContainer.class, null, propertyId);
426     }
427 
428     /**
429      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
430      * {@link BeanContainer} implementation by default.
431      * 
432      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
433      * 
434      * @param beanClass
435      *            type of the container.
436      * @param beanBuilder
437      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
438      * @param propertyId
439      *            the identifier of the property to use to find item identifiers.
440      * @return a BeanContainerFactory.
441      * 
442      * @since 0.2.0
443      */
444     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
445             HierarchicalBeanBuilder<I, T> beanBuilder, String propertyId) {
446         return getByAlgorithm(beanClass, null, HierarchicalBeanContainer.class, beanBuilder, propertyId);
447     }
448 
449     /**
450      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
451      * {@link BeanContainer} implementation by default.
452      * 
453      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
454      * 
455      * @param beanClass
456      *            type of the container.
457      * @param beanContainerType
458      *            the type of {@link AbstractBeanContainer} to use.
459      * @param beanIdResolver
460      *            the beanIdResolver to use to find item identifiers.
461      * @return a BeanContainerFactory.
462      * 
463      * @since 0.2.0
464      */
465     @SuppressWarnings("rawtypes")
466     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
467             Class<? extends AbstractBeanContainer> beanContainerType, BeanIdResolver<I, T> beanIdResolver) {
468         return getByAlgorithm(beanClass, null, beanContainerType, null, beanIdResolver);
469     }
470 
471     /**
472      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
473      * {@link BeanContainer} implementation by default.
474      * 
475      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
476      * 
477      * @param beanClass
478      *            type of the container.
479      * @param beanContainerType
480      *            the type of {@link AbstractBeanContainer} to use.
481      * @param beanBuilder
482      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
483      * @param beanIdResolver
484      *            the beanIdResolver to use to find item identifiers.
485      * @return a BeanContainerFactory.
486      * 
487      * @since 0.2.0
488      */
489     @SuppressWarnings("rawtypes")
490     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
491             Class<? extends AbstractBeanContainer> beanContainerType, HierarchicalBeanBuilder<I, T> beanBuilder,
492             BeanIdResolver<I, T> beanIdResolver) {
493         return getByAlgorithm(beanClass, null, beanContainerType, beanBuilder, beanIdResolver);
494     }
495 
496     /**
497      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
498      * {@link BeanContainer} implementation by default.
499      * 
500      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
501      * 
502      * @param beanClass
503      *            type of the container.
504      * @param beanContainerType
505      *            the type of {@link AbstractBeanContainer} to use.
506      * @param propertyId
507      *            the identifier of the property to use to find item identifiers.
508      * @return a BeanContainerFactory.
509      * 
510      * @since 0.2.0
511      */
512     @SuppressWarnings("rawtypes")
513     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
514             Class<? extends AbstractBeanContainer> beanContainerType, String propertyId) {
515         return getByAlgorithm(beanClass, null, beanContainerType, null, propertyId);
516     }
517 
518     /**
519      * Create a BeanContainerFactory of type T and idtype I using no {@link PropertyReaderAlgorithm} and the bean id resolver. It uses
520      * {@link BeanContainer} implementation by default.
521      * 
522      * @see HierarchicalBeanContainerFactory#getByAlgorithm(Class, PropertyReaderAlgorithm, Class, HierarchicalBeanBuilder, BeanIdResolver)
523      * 
524      * @param beanClass
525      *            type of the container.
526      * @param beanContainerType
527      *            the type of {@link AbstractBeanContainer} to use.
528      * @param beanBuilder
529      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
530      * @param propertyId
531      *            the identifier of the property to use to find item identifiers.
532      * @return a BeanContainerFactory.
533      * 
534      * @since 0.2.0
535      */
536     @SuppressWarnings("rawtypes")
537     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getSimple(Class<? super T> beanClass,
538             Class<? extends AbstractBeanContainer> beanContainerType, HierarchicalBeanBuilder<I, T> beanBuilder,
539             String propertyId) {
540         return getByAlgorithm(beanClass, null, beanContainerType, beanBuilder, propertyId);
541     }
542 
543     /**
544      * Create a BeanContainerFactory of type T and idtype I using a {@link PropertyReaderAlgorithm} and the bean id resolver.
545      * 
546      * @param beanClass
547      *            type of the container.
548      * @param algorithm
549      *            PropertyReaderAlgorithm to use.
550      * @param beanContainerType
551      *            the type of {@link AbstractBeanContainer} to use.
552      * @param beanBuilder
553      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
554      * @param beanIdResolver
555      *            the beanIdResolver to use to find item identifiers.
556      * @return a BeanContainerFactory.
557      * 
558      * @since 0.2.0
559      */
560     @SuppressWarnings("rawtypes")
561     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getByAlgorithm(Class<? super T> beanClass,
562             PropertyReaderAlgorithm algorithm, Class<? extends AbstractBeanContainer> beanContainerType,
563             HierarchicalBeanBuilder<I, T> beanBuilder, BeanIdResolver<I, T> beanIdResolver) {
564         return new AbstractHierarchicalBeanContainerFactory<I, T>(beanClass, algorithm, beanContainerType, beanIdResolver,
565                 beanBuilder) {
566         };
567     }
568 
569     /**
570      * Create a BeanContainerFactory of type T and idtype I using a {@link PropertyReaderAlgorithm} and the propertyId bean id resolver.
571      * 
572      * @param beanClass
573      *            type of the container.
574      * @param algorithm
575      *            PropertyReaderAlgorithm to use.
576      * @param beanContainerType
577      *            the type of {@link AbstractBeanContainer} to use.
578      * @param beanBuilder
579      *            the hierarchical beanBuilder to use to build a {@link Hierarchical}
580      * @param propertyId
581      *            the identifier of the property to use to find item identifiers.
582      * @return a BeanContainerFactory.
583      * 
584      * @since 0.2.0
585      */
586     @SuppressWarnings("rawtypes")
587     public final static <I, T> HierarchicalBeanContainerFactory<I, T> getByAlgorithm(Class<? super T> beanClass,
588             PropertyReaderAlgorithm algorithm, Class<? extends AbstractBeanContainer> beanContainerType,
589             HierarchicalBeanBuilder<I, T> beanBuilder, String propertyId) {
590         return new AbstractHierarchicalBeanContainerFactory<I, T>(beanClass, algorithm, beanContainerType, propertyId, beanBuilder) {
591         };
592     }
593 
594 }