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