1 14 package org.wings.event; 15 16 import java.lang.ref.WeakReference ; 17 18 19 30 public final class WeakRequestListenerProxy extends WeakReference implements SRequestListener { 31 32 33 public WeakRequestListenerProxy(SRequestListener requestListener) { 34 super(requestListener); 35 } 36 37 44 public void processRequest(SRequestEvent e) { 45 SRequestListener requestListener = (SRequestListener) get(); 46 47 if (requestListener == null) { 48 org.wings.session.SessionManager.getSession().removeRequestListener(this); 49 } else { 50 requestListener.processRequest(e); 51 } } 53 54 public int hashCode() { 55 Object requestListener = get(); 56 57 if (requestListener == null) { 58 return 0; 59 } else { 60 return requestListener.hashCode(); 61 } } 63 64 public boolean equals(WeakRequestListenerProxy p) { 65 Object requestListener = get(); 66 67 if (requestListener == null) { 68 return p.get() == null; 69 } else { 70 return requestListener.equals(p.get()); 71 } } 73 74 public boolean equals(Object o) { 75 if (o instanceof WeakRequestListenerProxy) { 76 return equals((WeakRequestListenerProxy) o); 77 } else { 78 return false; 79 } } 81 82 } 83 84 | Popular Tags |