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 18 19 public class SimpleMessage extends Message 20 { 21 protected String message; protected Object data; 24 25 public SimpleMessage( String message ) 26 { 27 this( message, null ); 28 } 29 30 public SimpleMessage( String message, Object data ) 31 { 32 this.message = message; 33 this.data = null; 34 } 35 36 37 public void write( PrintWriter writer, ProcessingUnit owner, Janitor janitor ) 38 { 39 if( owner instanceof SourceUnit ) 40 { 41 String name = ((SourceUnit)owner).getName(); 42 writer.println( "" + name + ": " + message ); 43 } 44 else 45 { 46 writer.println( message ); 47 } 48 } 49 50 51 public String getMessage() 52 { 53 return message; 54 } 55 56 } 57 58 59 60 61 | Popular Tags |