InputCode.java revision 560:dca8c03d693d
1/*
2 * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package build.tools.logutil;
26
27public class InputCode {
28
29  /**
30   * The name of this code.
31   */
32  private final String name;
33
34  /**
35   * The code.
36   */
37  private final int code;
38
39  /**
40   * The log level for this code.
41   */
42  private final String logLevel;
43
44  /**
45   * The error message for this code.
46   */
47  private final String message;
48
49  /**
50   * Creates a new error code with the specified name, code,
51   * log level and error message.
52   *
53   * @param name the name of the new code.
54   * @param code the code itself.
55   * @param logLevel the level of severity of this error.
56   * @param message the error message for this code.
57   */
58  public InputCode(final String name, final int code,
59                   final String logLevel, final String message) {
60    this.name = name;
61    this.code = code;
62    this.logLevel = logLevel;
63    this.message = message;
64  }
65
66  /**
67   * Returns the name of this code.
68   *
69   * @return the name of the code.
70   */
71  public String getName() {
72    return name;
73  }
74
75  /**
76   * Returns the code.
77   *
78   * @return the code.
79   */
80  public int getCode() {
81    return code;
82  }
83
84  /**
85   * Returns the severity of this code.
86   *
87   * @return the log level severity of the code.
88   */
89  public String getLogLevel() {
90    return logLevel;
91  }
92
93  /**
94   * Returns the error message for this code.
95   *
96   * @return the error message for this code.
97   */
98  public String getMessage() {
99    return message;
100  }
101
102  /**
103   * Returns a textual representation of this code.
104   *
105   * @return a textual representation.
106   */
107  public String toString() {
108    return getClass().getName() +
109      "[name=" + name +
110      ",code=" + code +
111      ",logLevel=" + logLevel +
112      ",message=" + message +
113      "]";
114  }
115
116}
117