lp.wrap
Class LparseMessage

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by lp.wrap.LparseMessage
All Implemented Interfaces:
Serializable

public class LparseMessage
extends RuntimeException

This class represents a warning or error message from lparse.

Version:
1.0.0
Author:
Martin Slota
See Also:
LparseWrapper, Serialized Form

Field Summary
private  int lineNumber
          Contains the number of line in the lparse's input to which this message is related.
private  boolean warning
          Is true if this is a warning message and false if it is an error message.
 
Constructor Summary
LparseMessage()
          Creates a new lparse error that has no a detail message.
LparseMessage(String message, int lineNumber)
          Creates a new lparse error with the specified detail message and line number.
LparseMessage(String message, int lineNumber, boolean isWarning)
          Creates a new lparse message with the specified detail message and line number.
 
Method Summary
 boolean equals(Object obj)
          Returns true iff obj is an instance of LparseMessage, is of the same type (as specified by isWarning()) and contains the same message for the same line number.
 int getLineNumber()
          Returns the number of line in the lparse's input to which this message is related.
 int hashCode()
          Overriden in order to maintain the general contract of Object.hashCode().
 boolean isWarning()
          Returns true if this is a warning message and false if it is an error message.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

warning

private final boolean warning
Is true if this is a warning message and false if it is an error message.


lineNumber

private final int lineNumber
Contains the number of line in the lparse's input to which this message is related. If the number is unknown, it must be set to -1.

Constructor Detail

LparseMessage

public LparseMessage()
Creates a new lparse error that has no a detail message. Has the same result as calling new LparseMessage(null, -1, false).


LparseMessage

public LparseMessage(String message,
                     int lineNumber)
Creates a new lparse error with the specified detail message and line number. Has the same result as calling new LparseMessage(message, lineNumber, false).

Parameters:
message - the detail message
lineNumber - the number of line in the lparse's input on which this error was found

LparseMessage

public LparseMessage(String message,
                     int lineNumber,
                     boolean isWarning)
Creates a new lparse message with the specified detail message and line number. If warning is true, then the message is just a warning. Otherwise it is an lparse error.

Parameters:
message - the detail message
lineNumber - the number of line in the lparse's input to which this message is related
isWarning - determines if this is a warning or error message
Method Detail

isWarning

public boolean isWarning()
Returns true if this is a warning message and false if it is an error message.

Returns:
as specified above

getLineNumber

public int getLineNumber()
Returns the number of line in the lparse's input to which this message is related. If the number is unknown, -1 is returned.

Returns:
as specified above

equals

public boolean equals(Object obj)
Returns true iff obj is an instance of LparseMessage, is of the same type (as specified by isWarning()) and contains the same message for the same line number.

Overrides:
equals in class Object
Returns:
as specified above

hashCode

public int hashCode()
Overriden in order to maintain the general contract of Object.hashCode().

Overrides:
hashCode in class Object
Returns:
the hash of this object