1 6 7 package org.jfox.jms; 8 9 import java.io.Serializable ; 10 import javax.jms.Destination ; 11 12 15 16 abstract class JMSDestination implements Destination , Serializable { 17 private String name; 18 19 public JMSDestination(String name) { 20 this.name = name; 21 } 22 23 public String toString() { 24 return "JMSDestination [" + (isTopic() ? "Topic" : "Queue") + "] " + getName(); 25 } 26 27 protected String getName() { 28 return name; 29 } 30 31 public boolean equals(Object pObject) { 32 if (this == pObject) return true; 33 if (!(pObject instanceof JMSDestination)) return false; 34 35 final JMSDestination jmsDestination = (JMSDestination) pObject; 36 37 if (name != null ? !name.equals(jmsDestination.name) : jmsDestination.name != null) return false; 38 39 return true; 40 } 41 42 public int hashCode() { 43 return (name != null ? name.hashCode() : 0); 44 } 45 46 protected abstract boolean isTopic(); 47 48 49 public static void main(String [] args) { 50 51 } 52 } 53 | Popular Tags |