CONTENTS | PREV | NEXT Extensible Runtime Containment and Services Protocol for JavaBeans

3.0 Overloading java.beans.instantiate() static method

Since java.beans.instantiate() is the current mechanism for (re)instantiating JavaBeans we need to extend or overload the syntax and semantics of this method in order to accommodate the introduction of the BeanContext abstraction. The extension proposed is:

public static Object instantiate(ClassLoader cl,
		              	 String	      beanName,
		                 BeanContext beanContext);
This method behaves has it is currently defined in the JavaBeans specification, but in addition to these existing semantics, when a non-null BeanContext is specified then the method invokes the add() method on the beanContext actual parameter with the value of the targetChild actual parameter = a reference to the newly instantiated JavaBean component.1

  1. Note: Since simple JavaBeans have no knowledge if a BeanContext, it is not advisable to introduce such instances into the hierarchy since there is no mechanism for these simple JavaBeans to remove themselves from the hierarchy and thus subsequently be garbage collected.

Copyright © 1998 Sun Microsystems, Inc. All Rights Reserved.