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