Example usage for java.beans.beancontext BeanContextSupport toArray

List of usage examples for java.beans.beancontext BeanContextSupport toArray

Introduction

In this page you can find the example usage for java.beans.beancontext BeanContextSupport toArray.

Prototype

public Object[] toArray() 

Source Link

Document

Gets all JavaBean or BeanContext instances currently nested in this BeanContext.

Usage

From source file:Example2.java

public static void main(String[] args) {

    // A BeanContext
    BeanContextSupport context = new BeanContextSupport();

    // Many JavaBeans
    BeanContextChildSupport[] beans = new BeanContextChildSupport[100];

    System.out.println("Number of children in the context: " + context.size());

    // Create the beans and add them to the context
    for (int i = 0; i < beans.length; i++) {
        beans[i] = new BeanContextSupport();
        context.add(beans[i]);//from w w w .  j a  v  a  2s . com
    }
    System.out.println("Number of children in the context: " + context.size());

    // Context now has 100 beans in it, get references to them all
    Object[] children = context.toArray();
    System.out.println("Number of objects retrieved from the context: " + children.length);
}