1 /* 2 * @(#)BeanContextProxy.java 1.11 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package java.beans.beancontext; 9 10 /** 11 * <p> 12 * This interface is implemented by a JavaBean that does 13 * not directly have a BeanContext(Child) associated with 14 * it (via implementing that interface or a subinterface thereof), 15 * but has a public BeanContext(Child) delegated from it. 16 * For example, a subclass of java.awt.Container may have a BeanContext 17 * associated with it that all Component children of that Container shall 18 * be contained within. 19 * </p> 20 * <p> 21 * An Object may not implement this interface and the 22 * BeanContextChild interface 23 * (or any subinterfaces thereof) they are mutually exclusive. 24 * </p> 25 * <p> 26 * Callers of this interface shall examine the return type in order to 27 * obtain a particular subinterface of BeanContextChild as follows: 28 * <code> 29 * BeanContextChild bcc = o.getBeanContextProxy(); 30 * 31 * if (bcc instanceof BeanContext) { 32 * // ... 33 * } 34 * </code> 35 * or 36 * <code> 37 * BeanContextChild bcc = o.getBeanContextProxy(); 38 * BeanContext bc = null; 39 * 40 * try { 41 * bc = (BeanContext)bcc; 42 * } catch (ClassCastException cce) { 43 * // cast failed, bcc is not an instanceof BeanContext 44 * } 45 * </code> 46 * </p> 47 * <p> 48 * The return value is a constant for the lifetime of the implementing 49 * instance 50 * </p> 51 * @author Laurence P. G. Cable 52 * @version 1.11, 12/19/03 53 * @since 1.2 54 * 55 * @see java.beans.beancontext.BeanContextChild 56 * @see java.beans.beancontext.BeanContextChildSupport 57 */ 58 59 public interface BeanContextProxy { 60 61 /** 62 * Gets the <code>BeanContextChild</code> (or subinterface) 63 * associated with this object. 64 * @return the <code>BeanContextChild</code> (or subinterface) 65 * associated with this object 66 */ 67 BeanContextChild getBeanContextProxy(); 68 } 69