1 17 package org.apache.geronimo.axis.builder; 18 19 import javax.xml.namespace.QName ; 20 21 24 public final class SchemaTypeKey { 25 public static final String QNAME_SCOPE_COMPLEX_TYPE = "complexType"; 26 public static final String QNAME_SCOPE_SIMPLE_TYPE = "simpleType"; 27 public static final String QNAME_SCOPE_ELEMENT = "element"; 28 29 private final QName qName; 30 private final String qNameScope; 31 private final boolean isElement; 32 private final boolean isSimpleType; 33 private final boolean isAnonymous; 34 35 private final QName elementQName; 36 37 38 public SchemaTypeKey(QName qName, boolean element, boolean isSimpleType, boolean anonymous, QName elementQName) { 39 assert qName != null; 40 this.qName = qName; 41 isElement = element; 42 this.isSimpleType = isSimpleType; 43 isAnonymous = anonymous; 44 if (isElement) { 45 qNameScope = QNAME_SCOPE_ELEMENT; 46 } else if (isSimpleType) { 47 qNameScope = QNAME_SCOPE_SIMPLE_TYPE; 48 } else { 49 qNameScope = QNAME_SCOPE_COMPLEX_TYPE; 50 } 51 this.elementQName = elementQName; 52 } 53 54 public QName getqName() { 55 return qName; 56 } 57 58 public boolean isElement() { 59 return isElement; 60 } 61 62 public boolean isSimpleType() { 63 return isSimpleType; 64 } 65 66 public boolean isAnonymous() { 67 return isAnonymous; 68 } 69 70 public String getqNameScope() { 71 return qNameScope; 72 } 73 74 public QName getElementQName() { 75 return elementQName; 76 } 77 78 public int hashCode() { 79 return qName.hashCode(); 80 } 81 82 public boolean equals(Object other) { 83 if (!(other instanceof SchemaTypeKey)) { 84 return false; 85 } 86 SchemaTypeKey key = (SchemaTypeKey) other; 87 return isElement == key.isElement && isSimpleType == key.isSimpleType && isAnonymous == key.isAnonymous && qName.equals(key.qName); 88 } 89 90 public String toString() { 91 StringBuffer buf = new StringBuffer ("\nSchemaTypeKey: scope: ").append(qNameScope); 92 buf.append(" isElement: ").append(isElement); 93 buf.append(" isAnonymous: ").append(isAnonymous); 94 buf.append(" isSimpleType: ").append(isSimpleType); 95 buf.append("\n QName: ").append(qName).append("\n"); 96 return buf.toString(); 97 } 98 99 100 } 101 | Popular Tags |