|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
SimpleMessage.java | 0% | 0% | 0% | 0% |
|
1 |
package org.codehaus.groovy.control.messages;
|
|
2 |
|
|
3 |
import java.io.PrintWriter;
|
|
4 |
|
|
5 |
import org.codehaus.groovy.control.Janitor;
|
|
6 |
import org.codehaus.groovy.control.ProcessingUnit;
|
|
7 |
import org.codehaus.groovy.control.SourceUnit;
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
/**
|
|
12 |
* A base class for compilation messages.
|
|
13 |
*
|
|
14 |
* @author <a href="mailto:cpoirier@dreaming.org">Chris Poirier</a>
|
|
15 |
*
|
|
16 |
* @version $Id: SimpleMessage.java,v 1.1 2004/04/19 07:29:45 cpoirier Exp $
|
|
17 |
*/
|
|
18 |
|
|
19 |
public class SimpleMessage extends Message |
|
20 |
{ |
|
21 |
protected String message; // Message text |
|
22 |
protected Object data; // Data, when the message text is an I18N identifier |
|
23 |
|
|
24 |
|
|
25 | 0 |
public SimpleMessage( String message )
|
26 |
{ |
|
27 | 0 |
this( message, null ); |
28 |
} |
|
29 |
|
|
30 | 0 |
public SimpleMessage( String message, Object data )
|
31 |
{ |
|
32 | 0 |
this.message = message;
|
33 | 0 |
this.data = null; |
34 |
} |
|
35 |
|
|
36 |
|
|
37 | 0 |
public void write( PrintWriter writer, ProcessingUnit owner, Janitor janitor ) |
38 |
{ |
|
39 | 0 |
if( owner instanceof SourceUnit ) |
40 |
{ |
|
41 | 0 |
String name = ((SourceUnit)owner).getName(); |
42 | 0 |
writer.println( "" + name + ": " + message ); |
43 |
} |
|
44 |
else
|
|
45 |
{ |
|
46 | 0 |
writer.println( message ); |
47 |
} |
|
48 |
} |
|
49 |
|
|
50 |
|
|
51 | 0 |
public String getMessage()
|
52 |
{ |
|
53 | 0 |
return message;
|
54 |
} |
|
55 |
|
|
56 |
} |
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|