1 7 package org.jboss.jms.destination; 8 9 import java.io.Serializable ; 10 11 import javax.jms.Destination ; 12 import javax.jms.JMSException ; 13 import javax.naming.NamingException ; 14 import javax.naming.Reference ; 15 import javax.naming.Referenceable ; 16 import javax.naming.StringRefAddr ; 17 18 24 public class JBossDestination 25 implements Destination , Referenceable , Serializable 26 { 27 29 31 32 private String name; 33 34 36 38 43 public JBossDestination(String name) 44 { 45 if (name == null) 46 throw new IllegalArgumentException ("Null name"); 47 this.name = name; 48 } 49 50 52 58 public String getName() 59 throws JMSException 60 { 61 return name; 62 } 63 64 66 68 public Reference getReference() 69 throws NamingException 70 { 71 return new Reference 72 ( 73 getClass().getName(), 74 new StringRefAddr ("name", name), 75 JBossDestinationFactory.class.getName(), 76 null 77 ); 78 } 79 80 82 public String toString() 83 { 84 return name; 85 } 86 87 public boolean equals(Object obj) 88 { 89 if (obj == null) return false; 90 if (obj == this) return true; 91 if (getClass() != obj.getClass()) return false; 92 JBossDestination other = (JBossDestination) obj; 93 return name.equals(other.name); 94 } 95 96 public int hashCode() 97 { 98 return name.hashCode(); 99 } 100 101 103 105 107 109 } 110 | Popular Tags |