-
EJB Observer Pattern (1 messages)
- Posted by: noname nosurname
- Posted on: August 28 2007 10:24 EDT
Hi, I've a problem. I've read the article about EJB Observer Pattern https://www.theserverside.com/tt/articles/article.tss?l=ObserverPattern but unfortunately I didn't understand this piece of code... (Tester.class) f.addObserver (obs); f.setSomething (args[0]); f.notifyObservers (args[1]); What are the 2 args that I must give at statup? Thanks in advance. Franco.Threaded Messages (1)
- the two args by Amy chang on September 06 2007 21:51 EDT
-
the two args[ Go to top ]
- Posted by: Amy chang
- Posted on: September 06 2007 21:51 EDT
- in response to noname nosurname
the first one could be a String Object, public void setSomething (String s) { mSomething = s; setChanged (true); /* We could call notifyObservers right here, but this may or may not be a good thing to do. Each call to notifyObservers will result in a remote method call for every registered observer. If there is more than one attribute to 'set' then it might be better for the caller to set them all and then call notifyObservers explicitly. */ } the secode one an arbitrary Object. public void update (EJBObservable observable, Object arg) { System.out.println ("Hey! I've been updated! " + "observable = " + observable.toString() + " arg = " + arg.toString()); }