org.codehaus.groovy.control.messages
Class WarningMessage

java.lang.Object
  extended byorg.codehaus.groovy.control.messages.Message
      extended byorg.codehaus.groovy.control.messages.SimpleMessage
          extended byorg.codehaus.groovy.control.messages.LocatedMessage
              extended byorg.codehaus.groovy.control.messages.WarningMessage

public class WarningMessage
extends LocatedMessage

A class for warning messages.

Version:
$Id: WarningMessage.java,v 1.1 2004/04/19 07:29:45 cpoirier Exp $
Author:
Chris Poirier

Field Summary
private  int importance
           
static int LIKELY_ERRORS
           
static int NONE
           
static int PARANOIA
           
static int POSSIBLE_ERRORS
           
 
Fields inherited from class org.codehaus.groovy.control.messages.LocatedMessage
context
 
Fields inherited from class org.codehaus.groovy.control.messages.SimpleMessage
data, message
 
Constructor Summary
WarningMessage(int importance, java.lang.String message, CSTNode context)
          Creates a new warning message.
WarningMessage(int importance, java.lang.String message, java.lang.Object data, CSTNode context)
          Creates a new warning message.
 
Method Summary
 boolean isRelevant(int importance)
          Returns true if this message is as or more important than the specified importance level.
static boolean isRelevant(int actual, int limit)
          Returns true if a warning would be relevant to the specified level.
 void write(java.io.PrintWriter writer, ProcessingUnit owner, Janitor janitor)
          Writes the message to the specified PrintWriter.
 
Methods inherited from class org.codehaus.groovy.control.messages.SimpleMessage
getMessage
 
Methods inherited from class org.codehaus.groovy.control.messages.Message
create, create, create, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

LIKELY_ERRORS

public static final int LIKELY_ERRORS
See Also:
Constant Field Values

POSSIBLE_ERRORS

public static final int POSSIBLE_ERRORS
See Also:
Constant Field Values

PARANOIA

public static final int PARANOIA
See Also:
Constant Field Values

importance

private int importance
Constructor Detail

WarningMessage

public WarningMessage(int importance,
                      java.lang.String message,
                      CSTNode context)
Creates a new warning message.

Parameters:
importance - the warning level
message - the message text
context - context information for locating the offending source text

WarningMessage

public WarningMessage(int importance,
                      java.lang.String message,
                      java.lang.Object data,
                      CSTNode context)
Creates a new warning message.

Parameters:
importance - the warning level
message - the message text
data - additional data needed when generating the message
context - context information for locating the offending source text
Method Detail

isRelevant

public static boolean isRelevant(int actual,
                                 int limit)
Returns true if a warning would be relevant to the specified level.


isRelevant

public boolean isRelevant(int importance)
Returns true if this message is as or more important than the specified importance level.


write

public void write(java.io.PrintWriter writer,
                  ProcessingUnit owner,
                  Janitor janitor)
Description copied from class: Message
Writes the message to the specified PrintWriter. The supplied ProcessingUnit is the unit that holds this Message.

Overrides:
write in class LocatedMessage


Copyright © 2003-2005 The Codehaus. All Rights Reserved.