001 /**
002 * Copyright 2007 Mike Kroutikov.
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the Lesser GNU General Public License as
006 * published by the Free Software Foundation; either version 3 of
007 * the License, or (at your option) any later version.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012 * Lesser GNU General Public License for more details.
013 *
014 * You should have received a copy of the Lesser GNU General Public License
015 * along with this program. If not, see <http://www.gnu.org/licenses/>.
016 *
017 * Derived from code developed by Opentick Corporation, http://www.opentick.com.
018 */
019
020 package org.otfeed.event;
021
022 import java.io.Serializable;
023
024 /**
025 * This class provides error information.
026 */
027 public final class OTError implements Serializable {
028
029 private static final long serialVersionUID = -4500092043902321750L;
030
031 private int requestId;
032 private int code;
033 private String description;
034
035 /**
036 * Default constructor.
037 */
038 public OTError() { }
039
040 /**
041 * Constructor.
042 * @param requestId ID of the request which caused the error.
043 * @param code Error code.
044 * @param description Description of the error.
045 */
046 public OTError(int requestId, int code, String description) {
047 this.requestId = requestId;
048 this.code = code;
049 this.description = description;
050 }
051
052 /**
053 *
054 * @return ID of the request which caused the error.
055 */
056 public int getRequestId() {
057 return requestId;
058 }
059
060 public void setRequestId(int requestId) {
061 this.requestId = requestId;
062 }
063
064 /**
065 *
066 * @return Error code.
067 */
068 public int getCode() {
069 return code;
070 }
071
072 /**
073 * Sets error code.
074 * @param code Error code.
075 */
076 public void setCode(int code) {
077 this.code = code;
078 }
079
080 /**
081 *
082 * @return Description of the error.
083 */
084 public String getDescription() {
085 return description;
086 }
087
088 /**
089 * Sets description of the error.
090 * @param description Description of the error.
091 */
092 public void setDescription(String description) {
093 this.description = description;
094 }
095
096 @Override
097 public String toString() {
098 return "OTError: requestId=" + requestId + ", code=" + code + ", desc=" + description;
099 }
100 }