Java プラットフォーム 1.2

java.beans.beancontext
クラス BeanContextSupport

java.lang.Object
  |
  +--java.beans.beancontext.BeanContextChildSupport
        |
        +--java.beans.beancontext.BeanContextSupport
直接の既知のサブクラス:
BeanContextServicesSupport

public class BeanContextSupport
extends BeanContextChildSupport
implements BeanContext, Serializable, PropertyChangeListener, VetoableChangeListener

このヘルパークラスは java.beans.beancontext.BeanContext インタフェースのユーティリティの実装を提供します。

このクラスは、BeanContext インタフェースを直接実装するため、この実装をサブクラス化することによって、あるいはほかのインスタンスからこのクラスのインスタンスの特別な委譲を介すことによって使用されることが意図されています。

導入されたバージョン:
JDK1.2
関連項目:
直列化された形式

内部クラスの概要
protected  class BeanContextSupport.BCSChild
           
protected static class BeanContextSupport.BCSIterator
          反復子をカプセル化し、無操作の remove() メソッドを実装する protected final サブクラスです。
 
フィールドの概要
protected  ArrayList bcmListeners
          protected ArrayList bcmListeners フィールドへのすべてのアクセスは、そのオブジェクトについて同期がとられます。
protected  HashMap children
          protected HashMap children フィールドへのすべてのアクセスは、そのオブジェクトについて同期がとられます。
protected  boolean designTime
           
protected  Locale locale
           
protected  boolean okToUseGui
           
 
クラス java.beans.beancontext.BeanContextChildSupport から継承したフィールド
beanContext, beanContextChildPeer, pcSupport, rejectedSetBCOnce, vcSupport
 
コンストラクタの概要
BeanContextSupport()
          ほかのオブジェクトの委譲でないインスタンスを生成します。
BeanContextSupport(BeanContext peer)
          デフォルトのロケールを使ってインスタンスを生成します。
BeanContextSupport(BeanContext peer, Locale lcle)
          指定されたロケールを使ってインスタンスを生成します。
BeanContextSupport(BeanContext peer, Locale lcle, boolean dtime)
          指定された Locale を使って設計モードでインスタンスを生成します。
BeanContextSupport(BeanContext peer, Locale lcle, boolean dTime, boolean visible)
           BeanContextSupport のインスタンスを生成します。
 
メソッドの概要
 boolean add(Object targetChild)
           この BeanContext 内に子を追加、すなわち入れ子にします。
 boolean addAll(Collection c)
          Children のセットに Collection を追加します (未サポート)。
 void addBeanContextMembershipListener(BeanContextMembershipListener bcml)
          BeanContextMembershipListener を追加します。
 boolean avoidingGui()
           
protected  Iterator bcsChildren()
           
protected  void bcsPreDeserializationHook(ObjectInputStream ois)
          defaultReadObject() のあとで、子の直列化復元の前に readObject によって呼び出されます。
protected  void bcsPreSerializationHook(ObjectOutputStream oos)
          defaultWriteObject() のあとで、現在直列化可能な子を直列化する前に writeObject によって呼び出されます。
protected  void childDeserializedHook(Object child, BeanContextSupport.BCSChild bcsc)
          新しく直列化復元された子および BCSChild を使って readObject によって呼び出されます。
protected  void childJustAddedHook(Object child, BeanContextSupport.BCSChild bcsc)
          サブクラスはこのメソッドをオーバーライドして、子が追加されて、イベント通知が発生する前に、簡単に add() セマンティクスを拡張できます。
protected  void childJustRemovedHook(Object child, BeanContextSupport.BCSChild bcsc)
          サブクラスはこのメソッドをオーバーライドして、子が削除されて、イベント通知が発生する前に、簡単に remove() セマンティクスを拡張できます。
protected static boolean classEquals(Class first, Class second)
           
 void clear()
          子をクリアします (未サポート)。
 boolean contains(Object o)
           
 boolean containsAll(Collection c)
           
 boolean containsKey(Object o)
           
protected  Object[] copyChildren()
           
protected  BeanContextSupport.BCSChild createBCSChild(Object targetChild, Object peer)
           サブクラスはこのメソッドをオーバーライドすることにより、セットに子を追加する add() メソッドやほかの Collection メソッドをオーバーライドすることなく、Child の独自のサブクラスを挿入することができます。
protected  void deserialize(ObjectInputStream ois, Collection coll)
          コレクションを直列化復元するために readObject によって使用されます。
 void dontUseGui()
          このインスタンスに GUI を描画できないことを通知します。
protected  void fireChildrenAdded(BeanContextMembershipEvent bcme)
          BeanContextMembershipListener インタフェースの BeanContextshipEvent をトリガーします。
protected  void fireChildrenRemoved(BeanContextMembershipEvent bcme)
          BeanContextMembershipListener インタフェースの BeanContextshipEvent をトリガーします。
 BeanContext getBeanContextPeer()
           
protected static BeanContextChild getChildBeanContextChild(Object child)
           
protected static BeanContextMembershipListener getChildBeanContextMembershipListener(Object child)
           
protected static PropertyChangeListener getChildPropertyChangeListener(Object child)
           
protected static Serializable getChildSerializable(Object child)
           
protected static VetoableChangeListener getChildVetoableChangeListener(Object child)
           
protected static Visibility getChildVisibility(Object child)
           
 Locale getLocale()
           
 URL getResource(String name, BeanContextChild bcc)
           
 InputStream getResourceAsStream(String name, BeanContextChild bcc)
           
protected  void initialize()
          BeanContextSupport のインスタンスの一時的な状態を初期化するためにコンストラクタおよび readObject メソッドから呼び出される protected メソッドです。
 Object instantiateChild(String beanName)
           instantiateChild メソッドは、Bean を入れ子にして BeanContext にインスタンスを生成する処理を単純化する BeanContext の簡易フックです。
 boolean isDesignTime()
           
 boolean isEmpty()
           
 boolean isSerializing()
           
 Iterator iterator()
           
 boolean needsGui()
           
 void okToUseGui()
          このインスタンスに GUI を描画できることを通知します。
 void propertyChange(PropertyChangeEvent pce)
          サブクラスは、子のプロパティの変更を監視するために包み込むことがあります。
 void readChildren(ObjectInputStream ois)
          このクラスのインスタンスが BeanContext プロトコル (およびそのサブプロトコル) の実装の委譲として使用されるときには、直列化復元の際に「鶏が先か卵が先か」の問題が起こります。
 boolean remove(Object targetChild)
           
protected  boolean remove(Object targetChild, boolean callChildSetBC)
           
 boolean removeAll(Collection c)
          指定されたすべての子を削除します (未サポート)。
 void removeBeanContextMembershipListener(BeanContextMembershipListener bcml)
          BeanContextMembershipListener を削除します。
 boolean retainAll(Collection c)
          指定された子だけを保持します (未サポート)。
protected  void serialize(ObjectOutputStream oos, Collection coll)
           
 void setDesignTime(boolean dTime)
           
 void setLocale(Locale newLocale)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] arry)
           
protected  boolean validatePendingAdd(Object targetChild)
           このクラスのサブクラスはこのメソッドをオーバーライドまたは包み込んで、BeanContext に追加される直前に、BeanContext が子オブジェクトを調べるための検証動作を追加できます。
protected  boolean validatePendingRemove(Object targetChild)
           このクラスのサブクラスはこのメソッドをオーバーライドまたは包み込んで、BeanContext から削除される直前に、BeanContext が子オブジェクトを調べるための検証動作を追加できます。
 void vetoableChange(PropertyChangeEvent pce)
          サブクラスは、子の拒否プロパティの変更を監視するために包み込むことがあります。
 void writeChildren(ObjectOutputStream oos)
           
 
クラス java.beans.beancontext.BeanContextChildSupport から継承したメソッド
addPropertyChangeListener, addVetoableChangeListener, firePropertyChange, fireVetoableChange, getBeanContext, getBeanContextChildPeer, initializeBeanContextResources, isDelegated, releaseBeanContextResources, removePropertyChangeListener, removeVetoableChangeListener, serviceAvailable, serviceRevoked, setBeanContext, validatePendingSetBeanContext
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

children

protected transient HashMap children
protected HashMap children フィールドへのすべてのアクセスは、そのオブジェクトについて同期がとられます。

bcmListeners

protected transient ArrayList bcmListeners
protected ArrayList bcmListeners フィールドへのすべてのアクセスは、そのオブジェクトについて同期がとられます。

locale

protected Locale locale

okToUseGui

protected boolean okToUseGui

designTime

protected boolean designTime
コンストラクタの詳細

BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          Locale lcle,
                          boolean dTime,
                          boolean visible)

BeanContextSupport のインスタンスを生成します。

パラメータ:
peer - 実装の提供先となるピア BeanContext。このオブジェクトが自身のピアである場合は null
lcle - この BeanContext の現在の Locale
dtime - 初期状態。設計モードの場合は true、実行時モードの場合は false
visible - 初期状態での可視性

BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          Locale lcle,
                          boolean dtime)
指定された Locale を使って設計モードでインスタンスを生成します。
パラメータ:
peer - 実装の提供先となるピア BeanContext。このオブジェクトが自身のピアである場合は null
lcle - この BeanContext の現在の Locale
dtime - 初期状態。設計モードの場合は true、実行時モードの場合は false

BeanContextSupport

public BeanContextSupport(BeanContext peer,
                          Locale lcle)
指定されたロケールを使ってインスタンスを生成します。
パラメータ:
peer - 実装の提供先となるピア BeanContext。このオブジェクトが自身のピアである場合は null
lcle - この BeanContext の現在の Locale

BeanContextSupport

public BeanContextSupport(BeanContext peer)
デフォルトのロケールを使ってインスタンスを生成します。
パラメータ:
peer - 実装の提供先となるピア BeanContext。このオブジェクトが自身のピアである場合は null

BeanContextSupport

public BeanContextSupport()
ほかのオブジェクトの委譲でないインスタンスを生成します。
メソッドの詳細

getBeanContextPeer

public BeanContext getBeanContextPeer()
戻り値:
このオブジェクトが実装を提供する BeanContext のインスタンス

instantiateChild

public Object instantiateChild(String beanName)
                        throws IOException,
                               ClassNotFoundException

instantiateChild メソッドは、Bean を入れ子にして BeanContext にインスタンスを生成する処理を単純化する BeanContext の簡易フックです。

beanName パラメータのセマンティクスは、java.beans.Beans.instantate によって定義されます。

定義:
インタフェース BeanContext 内の instantiateChild
パラメータ:
beanName - この BeanContext 内でインスタンスを生成する Bean の名前

size

public int size()
戻り値:
子の数

isEmpty

public boolean isEmpty()
戻り値:
子がないかどうか

contains

public boolean contains(Object o)
戻り値:
このオブジェクトが子であるかどうか

containsKey

public boolean containsKey(Object o)
戻り値:
このオブジェクトが子であるかどうか

iterator

public Iterator iterator()
戻り値:
反復子

toArray

public Object[] toArray()
戻り値:
子の配列

toArray

public Object[] toArray(Object[] arry)
戻り値:
子の配列

createBCSChild

protected BeanContextSupport.BCSChild createBCSChild(Object targetChild,
                                                     Object peer)

サブクラスはこのメソッドをオーバーライドすることにより、セットに子を追加する add() メソッドやほかの Collection メソッドをオーバーライドすることなく、Child の独自のサブクラスを挿入することができます。

パラメータ:
targetChild - Child を作成する子
peer - targetChild およびピアが BeanContextProxy によって関連付けられている場合はそのピア

add

public boolean add(Object targetChild)

この BeanContext 内に子を追加、すなわち入れ子にします。

java.beans.Beans.instantiate() の副作用として呼び出されます。

パラメータ:
targetChildren - この BeanContext 内で入れ子にされる子オブジェクト

remove

public boolean remove(Object targetChild)
パラメータ:
targetChildren - 削除される子オブジェクト

remove

protected boolean remove(Object targetChild,
                         boolean callChildSetBC)

containsAll

public boolean containsAll(Collection c)
戻り値:
指定された Collection 内のすべてのオブジェクトが子であるかどうか

addAll

public boolean addAll(Collection c)
Children のセットに Collection を追加します (未サポート)。実装では、階層のロックおよび「子」の protected フィールドについて同期をとる必要があります。

removeAll

public boolean removeAll(Collection c)
指定されたすべての子を削除します (未サポート)。実装では、階層のロックおよび「子」の protected フィールドについて同期をとる必要があります。

retainAll

public boolean retainAll(Collection c)
指定された子だけを保持します (未サポート)。実装では、階層のロックおよび「子」の protected フィールドについて同期をとる必要があります。

clear

public void clear()
子をクリアします (未サポート)。実装では、階層のロックおよび「子」の protected フィールドについて同期をとる必要があります。

addBeanContextMembershipListener

public void addBeanContextMembershipListener(BeanContextMembershipListener bcml)
BeanContextMembershipListener を追加します。
定義:
インタフェース BeanContext 内の addBeanContextMembershipListener
パラメータ:
bcml - 追加される BeanContextMembershipListener

removeBeanContextMembershipListener

public void removeBeanContextMembershipListener(BeanContextMembershipListener bcml)
BeanContextMembershipListener を削除します。
定義:
インタフェース BeanContext 内の removeBeanContextMembershipListener
パラメータ:
bcml - 削除される BeanContextMembershipListener

getResourceAsStream

public InputStream getResourceAsStream(String name,
                                       BeanContextChild bcc)
定義:
インタフェース BeanContext 内の getResourceAsStream
パラメータ:
name - 要求されたリソースの名前
child - 要求を行う子オブジェクト
戻り値:
InputStream として要求されたリソース

getResource

public URL getResource(String name,
                       BeanContextChild bcc)
定義:
インタフェース BeanContext 内の getResource
パラメータ:
name - 要求されたリソースの名前
child - 要求を行う子オブジェクト
戻り値:
InputStream として要求されたリソース

setDesignTime

public void setDesignTime(boolean dTime)
パラメータ:
dTime - 新しい designTime 値

isDesignTime

public boolean isDesignTime()
戻り値:
設計モード

setLocale

public void setLocale(Locale newLocale)
               throws PropertyVetoException
パラメータ:
newLocale - 新しいロケール

getLocale

public Locale getLocale()
戻り値:
BeanContext の現在の Locale

needsGui

public boolean needsGui()

dontUseGui

public void dontUseGui()
このインスタンスに GUI を描画できないことを通知します。

okToUseGui

public void okToUseGui()
このインスタンスに GUI を描画できることを通知します。

avoidingGui

public boolean avoidingGui()
戻り値:
このインスタンスが GUI の使用を避けるかどうか

isSerializing

public boolean isSerializing()
戻り値:
この BeanContext が現在直列化されているかどうか

bcsChildren

protected Iterator bcsChildren()
戻り値:
現在のすべての BCSChild 値の反復子

bcsPreSerializationHook

protected void bcsPreSerializationHook(ObjectOutputStream oos)
                                throws IOException
defaultWriteObject() のあとで、現在直列化可能な子を直列化する前に writeObject によって呼び出されます。このメソッドは、このスーパークラスが子を直列化する前に状態のカスタムの直列化を実行するために、サブクラスによってオーバーライドされる場合があります。ただし、サブクラスは writeObject() の独自の実装 (存在する場合) を置換するためにこのメソッドを使用することはできません。

bcsPreDeserializationHook

protected void bcsPreDeserializationHook(ObjectInputStream ois)
                                  throws IOException,
                                         ClassNotFoundException
defaultReadObject() のあとで、子の直列化復元の前に readObject によって呼び出されます。このメソッドは、このスーパークラスが子を直列化復元する前に状態のカスタムの直列化復元を実行するために、サブクラスによってオーバーライドされる場合があります。ただし、サブクラスは readObject() の独自の実装 (存在する場合) を置換するためにこのメソッドを使用することはできません。

childDeserializedHook

protected void childDeserializedHook(Object child,
                                     BeanContextSupport.BCSChild bcsc)
新しく直列化復元された子および BCSChild を使って readObject によって呼び出されます。

serialize

protected final void serialize(ObjectOutputStream oos,
                               Collection coll)
                        throws IOException

deserialize

protected final void deserialize(ObjectInputStream ois,
                                 Collection coll)
                          throws IOException,
                                 ClassNotFoundException
コレクションを直列化復元するために readObject によって使用されます。

writeChildren

public final void writeChildren(ObjectOutputStream oos)
                         throws IOException

readChildren

public final void readChildren(ObjectInputStream ois)
                        throws IOException,
                               ClassNotFoundException
このクラスのインスタンスが BeanContext プロトコル (およびそのサブプロトコル) の実装の委譲として使用されるときには、直列化復元の際に「鶏が先か卵が先か」の問題が起こります。

vetoableChange

public void vetoableChange(PropertyChangeEvent pce)
                    throws PropertyVetoException
サブクラスは、子の拒否プロパティの変更を監視するために包み込むことがあります。
定義:
インタフェース VetoableChangeListener 内の vetoableChange

propertyChange

public void propertyChange(PropertyChangeEvent pce)
サブクラスは、子のプロパティの変更を監視するために包み込むことがあります。
定義:
インタフェース PropertyChangeListener 内の propertyChange

validatePendingAdd

protected boolean validatePendingAdd(Object targetChild)

このクラスのサブクラスはこのメソッドをオーバーライドまたは包み込んで、BeanContext に追加される直前に、BeanContext が子オブジェクトを調べるための検証動作を追加できます。

戻り値:
子がこの BeanContext に追加された場合は true、そうでない場合は false

validatePendingRemove

protected boolean validatePendingRemove(Object targetChild)

このクラスのサブクラスはこのメソッドをオーバーライドまたは包み込んで、BeanContext から削除される直前に、BeanContext が子オブジェクトを調べるための検証動作を追加できます。

戻り値:
子がこの BeanContext から削除される場合は true、そうでない場合は false

childJustAddedHook

protected void childJustAddedHook(Object child,
                                  BeanContextSupport.BCSChild bcsc)
サブクラスはこのメソッドをオーバーライドして、子が追加されて、イベント通知が発生する前に、簡単に add() セマンティクスを拡張できます。このメソッドは同期化されている子を使って呼び出されます。

childJustRemovedHook

protected void childJustRemovedHook(Object child,
                                    BeanContextSupport.BCSChild bcsc)
サブクラスはこのメソッドをオーバーライドして、子が削除されて、イベント通知が発生する前に、簡単に remove() セマンティクスを拡張できます。このメソッドは同期化された子を使って呼び出されます。

getChildVisibility

protected static final Visibility getChildVisibility(Object child)
戻り値:
指定された Child に関連付けられている Component (存在する場合)

getChildSerializable

protected static final Serializable getChildSerializable(Object child)
戻り値:
指定された Child に関連付けられている Serializable (存在する場合)

getChildPropertyChangeListener

protected static final PropertyChangeListener getChildPropertyChangeListener(Object child)
戻り値:
指定された子の PropertyChangeListener (存在する場合)

getChildVetoableChangeListener

protected static final VetoableChangeListener getChildVetoableChangeListener(Object child)
戻り値:
指定された子の VetoableChangeListener (存在する場合)

getChildBeanContextMembershipListener

protected static final BeanContextMembershipListener getChildBeanContextMembershipListener(Object child)
戻り値:
指定された子の BeanContextMembershipListener (存在する場合)

getChildBeanContextChild

protected static final BeanContextChild getChildBeanContextChild(Object child)
戻り値:
指定された子の BeanContextChild (存在する場合)

fireChildrenAdded

protected final void fireChildrenAdded(BeanContextMembershipEvent bcme)
BeanContextMembershipListener インタフェースの BeanContextshipEvent をトリガーします。

fireChildrenRemoved

protected final void fireChildrenRemoved(BeanContextMembershipEvent bcme)
BeanContextMembershipListener インタフェースの BeanContextshipEvent をトリガーします。

initialize

protected void initialize()
BeanContextSupport のインスタンスの一時的な状態を初期化するためにコンストラクタおよび readObject メソッドから呼び出される protected メソッドです。このクラスは、子の PropertyChange および VetoableChange イベントを監視するのに使用される内部のクラスリスナーのインスタンスを生成するために、このメソッドを使用します。サブクラスはこのメソッドを包み込むことにより、独自の初期化動作を追加できます。

copyChildren

protected final Object[] copyChildren()
戻り値:
現在の入れ子にされた子のコピー

classEquals

protected static final boolean classEquals(Class first,
                                           Class second)
戻り値:
2 つのクラスオブジェクトまたはそれらの名前が同じで存在する場合

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.