edu.ksu.cis.projects.bogor.util
Class FileMessage

java.lang.Object
  extended by edu.ksu.cis.projects.bogor.util.FileMessage
All Implemented Interfaces:
Comparable

public class FileMessage
extends Object
implements Comparable

This class is used as a message related to a file position. Immutable.

Version:
CVS $Revision: 1.4 $ $Date: 2004/12/18 22:45:12 $
Author:
Robby, Matt Hoosier

Constructor Summary
protected FileMessage(int line, int column, String key, String text, String pattern)
           
protected FileMessage(String key, String text, String pattern)
           
 
Method Summary
static FileMessage buildMessage(int line, int column, String pattern, String[] args)
          Builds message using MessageFormat with line and column numbers info.
static FileMessage buildMessage(int line, int column, String key, String pattern, String[] args)
          Builds message using MessageFormat with line and column numbers info.
static FileMessage buildMessage(String pattern, String[] args)
          Builds message using MessageFormat.
static FileMessage buildMessage(String key, String pattern, String[] args)
          Builds message using MessageFormat.
 int compareTo(Object o)
           
 int getColumn()
          Gets the column number.
 int getLine()
          Gets the line number.
 String getOptionalKey()
           
 String getPattern()
           
 String getText()
          Gets the text.
 boolean hasLocation()
          Determines whether this message has a location info.
 String toString()
          Returns the string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileMessage

protected FileMessage(int line,
                      int column,
                      String key,
                      String text,
                      String pattern)

FileMessage

protected FileMessage(String key,
                      String text,
                      String pattern)
Method Detail

getColumn

public int getColumn()
Gets the column number.

Returns:
The column number.

getLine

public int getLine()
Gets the line number.

Returns:
The line number.

getText

public String getText()
Gets the text.

Returns:
The text. Non-null.

buildMessage

public static FileMessage buildMessage(String pattern,
                                       String[] args)
Builds message using MessageFormat.

Parameters:
pattern - The pattern for MessageFormat. Must be non-null.
args - The arguments for the pattern. Must be non-null. Each element must be non-null.
Returns:
The string of applying args to pattern.

buildMessage

public static FileMessage buildMessage(String key,
                                       String pattern,
                                       String[] args)
Builds message using MessageFormat.

Parameters:
key - The identifier of a particular property (e.g., a configuration option) to which this error applies.
pattern - The pattern for MessageFormat. Must be non-null.
args - The arguments for the pattern. Must be non-null. Each element must be non-null.
Returns:
The string of applying args to pattern.

buildMessage

public static FileMessage buildMessage(int line,
                                       int column,
                                       String key,
                                       String pattern,
                                       String[] args)
Builds message using MessageFormat with line and column numbers info. If line and column numbers are zero, then the info is discarded.

Parameters:
key - The identifier of a particular property (e.g., a configuration option) to which this error applies.
line - The line number associated to the message.
column - The column number associated to the message.
pattern - The pattern for MessageFormat. Must be non-null.
args - The arguments for the pattern. Must be non-null. Each element must be non-null.
Returns:
The string of applying args to pattern.

buildMessage

public static FileMessage buildMessage(int line,
                                       int column,
                                       String pattern,
                                       String[] args)
Builds message using MessageFormat with line and column numbers info. If line and column numbers are zero, then the info is discarded.

Parameters:
key - The identifier of a particular property (e.g., a configuration option) to which this error applies.
line - The line number associated to the message.
column - The column number associated to the message.
pattern - The pattern for MessageFormat. Must be non-null.
args - The arguments for the pattern. Must be non-null. Each element must be non-null.
Returns:
The string of applying args to pattern.

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable

hasLocation

public boolean hasLocation()
Determines whether this message has a location info.

Returns:
True, if this message has a location info. False, otherwise.

toString

public String toString()
Returns the string representation of this object.

Overrides:
toString in class Object
Returns:
"[ (line, column) ]text".

getOptionalKey

public String getOptionalKey()

getPattern

public String getPattern()