1 17 package org.apache.ws.jaxme.xs; 18 19 29 public final class XSElementOrAttrRef { 30 private final XSElement _element; 31 private final XSAttribute _attribute; 32 33 public XSElementOrAttrRef( XSElement element ) { 34 _element = element; 35 _attribute = null; 36 } 37 38 public XSElementOrAttrRef( XSAttribute attribute ) { 39 _element = null; 40 _attribute = attribute; 41 } 42 43 47 public XSElement getElement() { 48 return _element; 49 } 50 51 55 public XSAttribute getAttribute() { 56 return _attribute; 57 } 58 59 63 public boolean isAttributeRef() { 64 return _element == null; 65 } 66 67 public int hashCode() { 68 Object o; 69 70 if ( _element == null) { 71 o = _attribute; 72 } else { 73 o = _element; 74 } 75 76 return o.hashCode(); 77 } 78 79 public boolean equals( Object o ) { 80 if ( o == null || !(o instanceof XSElementOrAttrRef)) { 81 return false; 82 } 83 84 XSElementOrAttrRef other = (XSElementOrAttrRef) o; 85 if ( this.isAttributeRef() ) { 86 return this._attribute.equals( other._attribute ); 87 } else { 88 return this._element.equals( other._element ); 89 } 90 } 91 } 92 | Popular Tags |