Class BeanContainer<IDTYPE,BEANTYPE>

Type Parameters:
IDTYPE - The type of the item identifier
BEANTYPE - The type of the Bean
All Implemented Interfaces:
Container, Container.Filterable, Container.Indexed, Container.ItemSetChangeNotifier, Container.Ordered, Container.PropertySetChangeNotifier, Container.SimpleFilterable, Container.Sortable, Property.ValueChangeListener, Serializable

public class BeanContainer<IDTYPE,BEANTYPE> extends AbstractBeanContainer<IDTYPE,BEANTYPE>
An in-memory container for JavaBeans.

The properties of the container are determined automatically by introspecting the used JavaBean class. Only beans of the same type can be added to the container.

In BeanContainer (unlike BeanItemContainer), the item IDs do not have to be the beans themselves. The container can be used either with explicit item IDs or the item IDs can be generated when adding beans.

To use explicit item IDs, use the methods addItem(Object, Object), addItemAfter(Object, Object, Object) and addItemAt(int, Object, Object).

If a bean id resolver is set using setBeanIdResolver(AbstractBeanContainer.BeanIdResolver) or setBeanIdProperty(Object), the methods addBean(Object), addBeanAfter(Object, Object), addBeanAt(int, Object) and addAll(java.util.Collection) can be used to add items to the container. If one of these methods is called, the resolver is used to generate an identifier for the item (must not return null).

Note that explicit item identifiers can also be used when a resolver has been set by calling the addItem*() methods - the resolver is only used when adding beans using the addBean*() or addAll(Collection) methods.

It is not possible to add additional properties to the container.

Since:
6.5
See Also: