Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
and を使用して変更された属性と、Javaの古い値を取得できますか?ObserverObservable
Observer
Observable
notifyObservers新しい値である 1 つの属性のみを取得します。
notifyObservers
メソッド notifyObservers(Object obj) では、任意のオブジェクトを Observer に渡すことができます。このオブジェクトを、通信したいデータ (古い値や新しい値など) のコンテナーとして使用できます。オブザーバーでそれをキャストするだけで済みます。