1 /* 2 * reserved comment block 3 * DO NOT REMOVE OR ALTER! 4 */ 5 /* 6 * Licensed to the Apache Software Foundation (ASF) under one or more 7 * contributor license agreements. See the NOTICE file distributed with 8 * this work for additional information regarding copyright ownership. 9 * The ASF licenses this file to You under the Apache License, Version 2.0 10 * (the "License"); you may not use this file except in compliance with 11 * the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, software 16 * distributed under the License is distributed on an "AS IS" BASIS, 17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * See the License for the specific language governing permissions and 19 * limitations under the License. 20 */ 21 22 package com.sun.org.apache.xerces.internal.util; 23 24 /** 25 * <p>A structure that represents an error code, characterized by 26 * a domain and a message key.</p> 27 * 28 * @author Naela Nissar, IBM 29 * 30 */ 31 final class XMLErrorCode { 32 33 // 34 // Data 35 // 36 37 /** error domain **/ 38 private String fDomain; 39 40 /** message key **/ 41 private String fKey; 42 43 /** 44 * <p>Constructs an XMLErrorCode with the given domain and key.</p> 45 * 46 * @param domain The error domain. 47 * @param key The key of the error message. 48 */ XMLErrorCode(String domain, String key)49 public XMLErrorCode(String domain, String key) { 50 fDomain = domain; 51 fKey = key; 52 } 53 54 /** 55 * <p>Convenience method to set the values of an XMLErrorCode.</p> 56 * 57 * @param domain The error domain. 58 * @param key The key of the error message. 59 */ setValues(String domain, String key)60 public void setValues(String domain, String key) { 61 fDomain = domain; 62 fKey = key; 63 } 64 65 /** 66 * <p>Indicates whether some other object is equal to this XMLErrorCode.</p> 67 * 68 * @param obj the object with which to compare. 69 */ equals(Object obj)70 public boolean equals(Object obj) { 71 if (!(obj instanceof XMLErrorCode)) 72 return false; 73 XMLErrorCode err = (XMLErrorCode) obj; 74 return (fDomain.equals(err.fDomain) && fKey.equals(err.fKey)); 75 } 76 77 /** 78 * <p>Returns a hash code value for this XMLErrorCode.</p> 79 * 80 * @return a hash code value for this XMLErrorCode. 81 */ hashCode()82 public int hashCode() { 83 return fDomain.hashCode() + fKey.hashCode(); 84 } 85 } 86