diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-11-13 00:29:48 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-11-13 00:29:48 +0000 |
commit | 2a2b91f336fe4f6c2a314db2bc4cdffff6cf5a61 (patch) | |
tree | 21df1df36e4070dbe32198f06ea33964e82a998b /java/beans/beancontext/BeanContextSupport.java | |
parent | 237bdd93058f891ae4567cf4e051c5831bd4646b (diff) | |
download | classpath-2a2b91f336fe4f6c2a314db2bc4cdffff6cf5a61.tar.gz |
2006-11-13 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD-->generics from 2006/11/04-2006/11/12.
Diffstat (limited to 'java/beans/beancontext/BeanContextSupport.java')
-rw-r--r-- | java/beans/beancontext/BeanContextSupport.java | 75 |
1 files changed, 59 insertions, 16 deletions
diff --git a/java/beans/beancontext/BeanContextSupport.java b/java/beans/beancontext/BeanContextSupport.java index a12c078df..2dc2a4e4a 100644 --- a/java/beans/beancontext/BeanContextSupport.java +++ b/java/beans/beancontext/BeanContextSupport.java @@ -144,42 +144,61 @@ public class BeanContextSupport extends BeanContextChildSupport */ public BeanContextSupport () { - this (null, null, true, true); + this (null, null, false, true); } /** * Construct a BeanContextSupport instance. + * + * @param peer the bean context peer (<code>null</code> permitted). */ - public BeanContextSupport (BeanContext peer) + public BeanContextSupport(BeanContext peer) { - this (peer, null, true, true); + this (peer, null, false, true); } /** * Construct a BeanContextSupport instance. + * + * @param peer the bean context peer (<code>null</code> permitted). + * @param locale the locale (<code>null</code> permitted, equivalent to + * the default locale). */ - public BeanContextSupport (BeanContext peer, Locale lcle) + public BeanContextSupport (BeanContext peer, Locale locale) { - this (peer, lcle, true, true); + this (peer, locale, false, true); } /** * Construct a BeanContextSupport instance. + * + * @param peer the bean context peer (<code>null</code> permitted). + * @param locale the locale (<code>null</code> permitted, equivalent to + * the default locale). + * @param dtime a flag indicating whether or not the bean context is in + * design time mode. */ - public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime) + public BeanContextSupport (BeanContext peer, Locale locale, boolean dtime) { - this (peer, lcle, dtime, true); + this (peer, locale, dtime, true); } /** * Construct a BeanContextSupport instance. + * + * @param peer the bean context peer (<code>null</code> permitted). + * @param locale the locale (<code>null</code> permitted, equivalent to + * the default locale). + * @param dtime a flag indicating whether or not the bean context is in + * design time mode. + * @param visible initial value of the <code>okToUseGui</code> flag. */ - public BeanContextSupport (BeanContext peer, Locale lcle, boolean dtime, + public BeanContextSupport (BeanContext peer, Locale locale, boolean dtime, boolean visible) { super(peer); - locale = lcle == null ? Locale.getDefault() : lcle; + this.locale = locale == null ? Locale.getDefault() : locale; designTime = dtime; okToUseGui = visible; @@ -447,16 +466,40 @@ public class BeanContextSupport extends BeanContextChildSupport } } - public BeanContext getBeanContextPeer () - throws NotImplementedException + /** + * Returns the bean context peer. + * + * @return The bean context peer. + * + * @see BeanContextChildSupport#beanContextChildPeer + */ + public BeanContext getBeanContextPeer() { - throw new Error ("Not implemented"); + 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) |