KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > asm > StructureMessage


1
2 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3  *
4  * This file is part of the IDE support for the AspectJ(tm)
5  * programming language; see http://aspectj.org
6  *
7  * The contents of this file are subject to the Mozilla Public License
8  * Version 1.1 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is AspectJ.
18  *
19  * The Initial Developer of the Original Code is Xerox Corporation. Portions
20  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
21  * All Rights Reserved.
22  *
23  * Contributor(s):
24  */

25
26 package org.aspectj.asm;
27
28 import java.io.*;
29
30 /**
31  * @author Mik Kersten
32  */

33 public class StructureMessage implements Serializable {
34     
35     private Kind kind;
36     private String JavaDoc message;
37     
38     public StructureMessage(String JavaDoc message, Kind kind) {
39         this.message = message;
40         this.kind = kind;
41     }
42
43     public String JavaDoc getMessage() {
44         return message;
45     }
46
47     public Kind getKind() {
48         return kind;
49     }
50
51     /**
52      * Uses "typesafe enum" pattern.
53      */

54     public static class Kind implements Serializable {
55         public static final Kind ERROR = new Kind("error");
56         public static final Kind WARNING = new Kind("warning");
57         public static final Kind INFO = new Kind("info");
58         public static final Kind[] ALL = { ERROR, WARNING, INFO };
59         private final String JavaDoc name;
60         
61         private Kind(String JavaDoc name) {
62             this.name = name;
63         }
64         
65         public String JavaDoc toString() {
66             return name;
67         }
68         
69         // The 4 declarations below are necessary for serialization
70
private static int nextOrdinal = 0;
71         private final int ordinal = nextOrdinal++;
72         private Object JavaDoc readResolve() throws ObjectStreamException {
73             return ALL[ordinal];
74         }
75     }
76 }
77
Popular Tags