2
* Copyright 2003-2007 the original author or authors.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
package org.codehaus.groovy.control.messages;
19
import java.io.PrintWriter;
21
import org.codehaus.groovy.control.Janitor;
22
import org.codehaus.groovy.control.ProcessingUnit;
23
import org.codehaus.groovy.control.SourceUnit;
28
* A base class for compilation messages.
30
* @author <a href="mailto:cpoirier@dreaming.org">Chris Poirier</a>
32
* @version $Id: SimpleMessage.java 6778 2007-07-02 10:40:33Z glaforge $
35
public class SimpleMessage extends Message
37
protected String message; // Message text
38
protected Object data; // Data, when the message text is an I18N identifier
39
protected ProcessingUnit owner;
41
public SimpleMessage( String message, ProcessingUnit source )
43
this( message, null, source );
46
public SimpleMessage( String message, Object data, ProcessingUnit source )
48
this.message = message;
54
public void write( PrintWriter writer, Janitor janitor )
56
if( owner instanceof SourceUnit )
58
String name = ((SourceUnit)owner).getName();
59
writer.println( "" + name + ": " + message );
63
writer.println( message );
68
public String getMessage()
2
* Copyright 2003-2007 the original author or authors.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
package org.codehaus.groovy.control.messages;
19
import java.io.PrintWriter;
21
import org.codehaus.groovy.control.Janitor;
22
import org.codehaus.groovy.control.ProcessingUnit;
23
import org.codehaus.groovy.control.SourceUnit;
28
* A base class for compilation messages.
30
* @author <a href="mailto:cpoirier@dreaming.org">Chris Poirier</a>
32
* @version $Id: SimpleMessage.java 6778 2007-07-02 10:40:33Z glaforge $
35
public class SimpleMessage extends Message
37
protected String message; // Message text
38
protected Object data; // Data, when the message text is an I18N identifier
39
protected ProcessingUnit owner;
41
public SimpleMessage( String message, ProcessingUnit source )
43
this( message, null, source );
46
public SimpleMessage( String message, Object data, ProcessingUnit source )
48
this.message = message;
54
public void write( PrintWriter writer, Janitor janitor )
56
if( owner instanceof SourceUnit )
58
String name = ((SourceUnit)owner).getName();
59
writer.println( "" + name + ": " + message );
63
writer.println( message );
68
public String getMessage()