1 /*
2 * Copyright 1998-2002 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any 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 * <code>
47 * BeanContextChild bcc = o.getBeanContextProxy();
48 *
49 * if (bcc instanceof BeanContext) {
50 * // ...
51 * }
52 * </code>
53 * or
54 * <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 * </code>
64 * </p>
65 * <p>
66 * The return value is a constant for the lifetime of the implementing
67 * instance
68 * </p>
69 * @author Laurence P. G. Cable
70 * @since 1.2
71 *
72 * @see java.beans.beancontext.BeanContextChild
73 * @see java.beans.beancontext.BeanContextChildSupport
74 */
75
76 public interface BeanContextProxy {
77
78 /**
79 * Gets the <code>BeanContextChild</code> (or subinterface)
80 * associated with this object.
81 * @return the <code>BeanContextChild</code> (or subinterface)
82 * associated with this object
83 */
84 BeanContextChild getBeanContextProxy();
85 }