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