Example usage for java.beans.beancontext BeanContextSupport instantiateChild

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

Introduction

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

Prototype

public Object instantiateChild(String beanName) throws IOException, ClassNotFoundException 

Source Link

Document

The instantiateChild method is a convenience hook in BeanContext to simplify the task of instantiating a Bean, nested, into a BeanContext .

Usage

From source file:Example3.java

public static void main(String[] args) {
    BeanContextSupport context = new BeanContextSupport();
    System.out.println("Number of children nested into the context: " + context.size());

    BeanContextChildSupport child = null;
    try {/*from w  ww .  j  a  v  a 2s . c o  m*/
        child = (BeanContextChildSupport) context
                .instantiateChild("java.beans.beancontext.BeanContextChildSupport");
    } catch (IOException e) {
        System.out.println("IOException occurred: " + e.getMessage());
    } catch (ClassNotFoundException e) {
        System.out.println("Class not found: " + e.getMessage());
    }
    System.out.println("Number of children nested into the context: " + context.size());
}