diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | java/beans/beancontext/BeanContextSupport.java | 26 |
2 files changed, 27 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2006-11-11 David Gilbert <david.gilbert@object-refinery.com> + + * java/beans/beancontext/BeanContextSupport.java + (getChildBeanContextChild): Implemented. + 2006-11-10 Roman Kennke <kennke@aicas.com> * javax/swing/text/View.java diff --git a/java/beans/beancontext/BeanContextSupport.java b/java/beans/beancontext/BeanContextSupport.java index 4e8c5bbea..2dc2a4e4a 100644 --- a/java/beans/beancontext/BeanContextSupport.java +++ b/java/beans/beancontext/BeanContextSupport.java @@ -478,10 +478,28 @@ public class BeanContextSupport extends BeanContextChildSupport return (BeanContext) beanContextChildPeer; } - protected static final BeanContextChild getChildBeanContextChild (Object child) - throws NotImplementedException - { - throw new Error ("Not implemented"); + /** + * Returns the {@link BeanContextChild} implementation for the given child. + * + * @param child the child (<code>null</code> permitted). + * + * @return The bean context child. + * + * @throws IllegalArgumentException if <code>child</code> implements both + * the {@link BeanContextChild} and {@link BeanContextProxy} interfaces. + */ + protected static final BeanContextChild getChildBeanContextChild(Object child) + { + if (child == null) + return null; + if (child instanceof BeanContextChild && child instanceof BeanContextProxy) + throw new IllegalArgumentException("Child cannot implement " + + "BeanContextChild and BeanContextProxy simultaneously."); + if (child instanceof BeanContextChild) + return (BeanContextChild) child; + if (child instanceof BeanContextProxy) + return ((BeanContextProxy) child).getBeanContextProxy(); + return null; } protected static final BeanContextMembershipListener getChildBeanContextMembershipListener (Object child) |