xbn.output
Class MsgFormat

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.output.MsgFormat
Direct Known Subclasses:
MFDate, MFPlain

public abstract class MsgFormat
extends XBNObject

Represents the formatting of each line of output. Managed by OConfig.

Source code:  MsgFormat.java.  Example code  See the example code for MFDate and MFPlain

The most common MsgFormat is a date/time stamp. If you desire no MsgFormat, then use MFPlain. Otherwise, extend this class to make a specialized prefix of your very own.


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
MsgFormat()
          Create a MsgFormat.
MsgFormat(String s_indent)
          Create a MsgFormat.
 
Method Summary
abstract  String getFormatted(boolean b_useIndent, String s_message)
          Get the message with all formatting applied.
 String getIndent()
          Get the current indent text.
 boolean hasIndent()
          Does this MsgFormat object have any indent text?
 void setIndent(String s_indent)
          Set the indent text.
 String toString()
          Get some information about this MsgFormat object.
 
Methods inherited from class xbn.XBNObject
getXMsgPrefix, sop, sopl, sopl, throwAX, throwAXIfBadStr, throwAXIfNull, throwAXSpoof
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MsgFormat

public MsgFormat()

Create a MsgFormat.

Equal to MsgFormat(null)


MsgFormat

public MsgFormat(String s_indent)

Create a MsgFormat.

See setIndent and getIndent.

Parameters:
s_indent - The text that should precede every line of output.
Method Detail

getFormatted

public abstract String getFormatted(boolean b_useIndent,
                                    String s_message)

Get the message with all formatting applied.

Parameters:
b_useIndent - If true, then the indent should be applied. If false, no indent should be used.

hasIndent

public final boolean hasIndent()

Does this MsgFormat object have any indent text?

Returns:
true There is indent text. A non null value for s_indent was provided to the constructor of this class. The indent text can be retrieved from getIndent.
false There is no indent text. getIndent will return null.

setIndent

public final void setIndent(String s_indent)

Set the indent text.

Get with getIndent

Parameters:
s_indent - The indent text. If null, then hasIndent will return false. Otherwise, it will return true.

getIndent

public final String getIndent()

Get the current indent text.

Set with setIndent

Returns:
A string If there is indent text (hasIndent equals true in this case), or
null If there is none. isIndent equals false.

toString

public String toString()

Get some information about this MsgFormat object.

Overrides:
toString in class Object



Copyright 1997-2003, Jeff Epstein, All Rights Reserved. See top of source code files for copyright notice.

 

http://sourceforge.net/projects/xbnjava

 

SourceForge.net Logo