AttributeKey.java :  » XML » cambridge » cambridge » model » Java Open Source

Java Open Source » XML » cambridge 
cambridge » cambridge » model » AttributeKey.java
package cambridge.model;

/**
 * User: erdinc
 * Date: Nov 1, 2009
 * Time: 1:15:50 PM
 */
public class AttributeKey {
   protected final String namespace;
   protected final String attribute;

   @Override
   public boolean equals(Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;

      AttributeKey that = (AttributeKey) o;

      return attribute.equals(that.attribute) && !(namespace != null ? !namespace.equals(that.namespace) : that.namespace != null);
   }

   @Override
   public int hashCode() {
      int result = namespace != null ? namespace.hashCode() : 0;
      result = 31 * result + attribute.hashCode();
      return result;
   }

   public AttributeKey(String namespace, String attribute) {
      this.namespace = namespace;
      this.attribute = attribute;
   }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.