diff options
author | David Gilbert <david.gilbert@object-refinery.com> | 2006-11-11 06:14:17 +0000 |
---|---|---|
committer | David Gilbert <david.gilbert@object-refinery.com> | 2006-11-11 06:14:17 +0000 |
commit | 5a7231e58f2b64cd18389479181b89e8da7e1bae (patch) | |
tree | 59c2e9a7ddb5f5f10a4f7e6e468a4636fe5c95ce /java | |
parent | 3c80784c4c2f2983b6fef0b0278ad85305fc5cf7 (diff) | |
download | classpath-5a7231e58f2b64cd18389479181b89e8da7e1bae.tar.gz |
2006-11-11 David Gilbert <david.gilbert@object-refinery.com>
* java/beans/beancontext/BeanContextSupport.java
(getChildBeanContextChild): Implemented.
Diffstat (limited to 'java')
-rw-r--r-- | java/beans/beancontext/BeanContextSupport.java | 26 |
1 files changed, 22 insertions, 4 deletions
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) |