1 /* 2 * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package java.beans.beancontext; 27 28 /** 29 * <p> 30 * This interface is implemented by a JavaBean that does 31 * not directly have a BeanContext(Child) associated with 32 * it (via implementing that interface or a subinterface thereof), 33 * but has a public BeanContext(Child) delegated from it. 34 * For example, a subclass of java.awt.Container may have a BeanContext 35 * associated with it that all Component children of that Container shall 36 * be contained within. 37 * </p> 38 * <p> 39 * An Object may not implement this interface and the 40 * BeanContextChild interface 41 * (or any subinterfaces thereof) they are mutually exclusive. 42 * </p> 43 * <p> 44 * Callers of this interface shall examine the return type in order to 45 * obtain a particular subinterface of BeanContextChild as follows: 46 * <pre>{@code 47 * BeanContextChild bcc = o.getBeanContextProxy(); 48 * 49 * if (bcc instanceof BeanContext) { 50 * // ... 51 * } 52 * }</pre> 53 * or 54 * <pre>{@code 55 * BeanContextChild bcc = o.getBeanContextProxy(); 56 * BeanContext bc = null; 57 * 58 * try { 59 * bc = (BeanContext)bcc; 60 * } catch (ClassCastException cce) { 61 * // cast failed, bcc is not an instanceof BeanContext 62 * } 63 * }</pre> 64 * <p> 65 * The return value is a constant for the lifetime of the implementing 66 * instance 67 * </p> 68 * @author Laurence P. G. Cable 69 * @since 1.2 70 * 71 * @see java.beans.beancontext.BeanContextChild 72 * @see java.beans.beancontext.BeanContextChildSupport 73 */ 74 75 public interface BeanContextProxy { 76 77 /** 78 * Gets the {@code BeanContextChild} (or subinterface) 79 * associated with this object. 80 * @return the {@code BeanContextChild} (or subinterface) 81 * associated with this object 82 */ 83 BeanContextChild getBeanContextProxy(); 84 } --- EOF ---