Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.codegen.processor/src/com/oracle/truffle/codegen/processor/template/MessageContainer.java @ 8255:1384c39e2c53
Added missing class MessageContainer.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Wed, 13 Mar 2013 20:00:33 +0100 |
parents | |
children | 4dc7034317ec |
rev | line source |
---|---|
8255
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.codegen.processor.template; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import java.util.*; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 import javax.lang.model.element.*; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 import javax.tools.Diagnostic.Kind; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
29 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
30 import com.oracle.truffle.codegen.processor.*; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
31 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
32 public abstract class MessageContainer { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
34 private final List<Message> messages = new ArrayList<>(); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
35 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
36 public final void addWarning(String text, Object... params) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
37 getMessages().add(new Message(this, String.format(text, params), Kind.WARNING)); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
38 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
39 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
40 public final void addError(String text, Object... params) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
41 getMessages().add(new Message(this, String.format(text, params), Kind.ERROR)); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
42 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
43 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
44 protected List<MessageContainer> findChildContainers() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
45 return Collections.emptyList(); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
46 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
47 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
48 public abstract Element getMessageElement(); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
49 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
50 public final void emitMessages(TypeElement baseElement, Log log) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
51 emitMessagesImpl(baseElement, log, new HashSet<MessageContainer>()); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
52 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
53 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
54 private void emitMessagesImpl(TypeElement baseElement, Log log, Set<MessageContainer> visitedSinks) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 for (Message message : getMessages()) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 emitDefault(baseElement, log, message); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
58 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
59 for (MessageContainer sink : findChildContainers()) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
60 if (visitedSinks.contains(sink)) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
61 return; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
62 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
63 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
64 visitedSinks.add(sink); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
65 sink.emitMessagesImpl(baseElement, log, visitedSinks); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
66 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
67 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
68 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
69 private void emitDefault(TypeElement baseType, Log log, Message message) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
70 if (Utils.typeEquals(baseType.asType(), Utils.findRootEnclosingType(getMessageElement()).asType()) && this == message.getOriginalContainer()) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
71 log.message(message.getKind(), getMessageElement(), getMessageAnnotation(), getMessageAnnotationValue(), message.getText()); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
72 } else { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
73 MessageContainer original = message.getOriginalContainer(); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
74 log.message(message.getKind(), baseType, null, null, wrapText(original.getMessageElement(), original.getMessageAnnotation(), message.getText())); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
75 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
76 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
77 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
78 private static String wrapText(Element element, AnnotationMirror mirror, String text) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
79 StringBuilder b = new StringBuilder(); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
80 if (element != null) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
81 b.append("Element " + element.toString()); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
82 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
83 if (mirror != null) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
84 b.append(" at annotation @" + Utils.getSimpleName(mirror.getAnnotationType())); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
85 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
86 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
87 if (b.length() > 0) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
88 b.append(" is erroneous: ").append(text); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
89 return b.toString(); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
90 } else { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
91 return text; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
92 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
93 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
94 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
95 public AnnotationMirror getMessageAnnotation() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
96 return null; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
97 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
98 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
99 public AnnotationValue getMessageAnnotationValue() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
100 return null; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
101 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
102 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
103 public final boolean hasErrors() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
104 return hasErrorsImpl(new HashSet<MessageContainer>()); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
105 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
106 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
107 public final List<Message> collectMessages() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
108 List<Message> collectedMessages = new ArrayList<>(); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
109 collectMessagesImpl(collectedMessages, new HashSet<MessageContainer>()); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
110 return collectedMessages; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
111 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
112 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
113 private void collectMessagesImpl(List<Message> collectedMessages, Set<MessageContainer> visitedSinks) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
114 collectedMessages.addAll(getMessages()); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
115 for (MessageContainer sink : findChildContainers()) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
116 if (visitedSinks.contains(sink)) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
117 return; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
118 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
119 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
120 visitedSinks.add(sink); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
121 sink.collectMessagesImpl(collectedMessages, visitedSinks); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
122 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
123 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
124 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
125 private boolean hasErrorsImpl(Set<MessageContainer> visitedSinks) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
126 for (Message msg : getMessages()) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
127 if (msg.getKind() == Kind.ERROR) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
128 return true; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
129 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
130 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
131 for (MessageContainer sink : findChildContainers()) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
132 if (visitedSinks.contains(sink)) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
133 return false; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
134 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
135 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
136 visitedSinks.add(sink); |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
137 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
138 if (sink.hasErrorsImpl(visitedSinks)) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
139 return true; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
140 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
141 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
142 return false; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
143 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
144 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
145 public List<Message> getMessages() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
146 return messages; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
147 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
148 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
149 public static class Message { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
150 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
151 private final MessageContainer originalContainer; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
152 private final String text; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
153 private final Kind kind; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
154 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
155 public Message(MessageContainer originalContainer, String text, Kind kind) { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
156 this.originalContainer = originalContainer; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
157 this.text = text; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
158 this.kind = kind; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
159 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
160 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
161 public MessageContainer getOriginalContainer() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
162 return originalContainer; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
163 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
164 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
165 public String getText() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
166 return text; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
167 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
168 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
169 public Kind getKind() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
170 return kind; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
171 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
172 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
173 @Override |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
174 public String toString() { |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
175 return kind + ": " + text; |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
176 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
177 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
178 } |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
179 |
1384c39e2c53
Added missing class MessageContainer.
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
180 } |