annotate src/org/tmatesoft/hg/util/Status.java @ 380:9517df1ef7ec

Comments/javadoc
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 09 Feb 2012 18:57:14 +0100
parents 150500515714
children
rev   line source
360
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2011 TMate Software Ltd
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.util;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import org.tmatesoft.hg.internal.Experimental;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 /**
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 * Success/failure descriptor. When exception is too much.
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 *
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 * @author Artem Tikhomirov
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25 * @author TMate Software Ltd.
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 */
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 @Experimental(reason="Accidental use, does not justify dedicated class, perhaps.")
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28 public class Status {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29 // XXX perhaps private enum and factory method createError() and createOk()?
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 public enum Kind {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 OK, ERROR;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 }
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 private final Kind kind;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 private final String message;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 private final Exception error;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 public Status(Kind k, String msg) {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 this(k, msg, null);
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 }
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 public Status(Kind k, String msg, Exception err) {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43 kind = k;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44 message = msg;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45 error = err;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 }
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 public boolean isOk() {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49 return kind == Kind.OK;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50 }
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
52 public Kind getKind() {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
53 return kind;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
54 }
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
56 public String getMessage() {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
57 return message;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
58 }
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
59
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
60 public Exception getException() {
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
61 return error;
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
62 }
150500515714 Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
63 }