1 16 package org.apache.axis2.saaj; 17 18 import javax.xml.namespace.QName ; 19 import javax.xml.soap.Name ; 20 21 26 public class PrefixedQName implements Name { 27 28 private static final String emptyString = "".intern(); 29 30 33 private String prefix; 34 37 private QName qName; 38 39 45 public PrefixedQName(String uri, String localName, String pre) { 46 qName = new QName (uri, localName); 47 prefix = (pre == null) 48 ? emptyString 49 : pre.intern(); 50 } 51 52 57 public PrefixedQName(QName qname) { 58 this.qName = qname; 59 prefix = emptyString; 60 } 61 62 66 public String getLocalName() { 67 return qName.getLocalPart(); 68 } 69 70 74 public String getQualifiedName() { 75 StringBuffer buf = new StringBuffer (prefix); 76 if(prefix != emptyString) 77 buf.append(':'); 78 buf.append(qName.getLocalPart()); 79 return buf.toString(); 80 } 81 82 86 public String getURI() { 87 return qName.getNamespaceURI(); 88 } 89 90 94 public String getPrefix() { 95 return prefix; 96 } 97 98 103 public boolean equals(Object obj) { 104 if (obj == this) { 105 return true; 106 } 107 if (!(obj instanceof PrefixedQName)) { 108 return false; 109 } 110 if (!qName.equals(((PrefixedQName)obj).qName)) { 111 return false; 112 } 113 if (prefix == ((PrefixedQName) obj).prefix) { 114 return true; 115 } 116 return false; 117 } 118 119 123 public int hashCode() { 124 return prefix.hashCode() + qName.hashCode(); 125 } 126 127 131 public String toString() { 132 return qName.toString(); 133 } 134 } 135 | Popular Tags |