1 16 17 package org.apache.axis.message; 18 19 import javax.xml.namespace.QName ; 20 import javax.xml.soap.Name ; 21 22 public class PrefixedQName implements Name { 23 24 private static final String emptyString = "".intern(); 25 26 private String prefix; 27 private QName qName; 28 29 public PrefixedQName(String uri, String localName, String pre) { 30 qName = new QName (uri, localName); 31 prefix = (pre == null) 32 ? emptyString 33 : pre.intern(); 34 } 35 36 public PrefixedQName(QName qname) { 37 this.qName = qname; 38 prefix = emptyString; 39 } 40 41 public String getLocalName() { 42 return qName.getLocalPart(); 43 } 44 45 public String getQualifiedName() { 46 StringBuffer buf = new StringBuffer (prefix); 47 if(prefix != emptyString) 48 buf.append(':'); 49 buf.append(qName.getLocalPart()); 50 return buf.toString(); 51 } 52 53 public String getURI() { 54 return qName.getNamespaceURI(); 55 } 56 57 public String getPrefix() { 58 return prefix; 59 } 60 public boolean equals(Object obj) { 61 if (obj == this) { 62 return true; 63 } 64 if (!(obj instanceof PrefixedQName)) { 65 return false; 66 } 67 if (!qName.equals(((PrefixedQName)obj).qName)) { 68 return false; 69 } 70 if (prefix == ((PrefixedQName) obj).prefix) { 71 return true; 72 } 73 return false; 74 } 75 76 public int hashCode() { 77 return prefix.hashCode() + qName.hashCode(); 78 } 79 80 public String toString() { 81 return qName.toString(); 82 } 83 } 84 | Popular Tags |