xbn
Class XBNObject

java.lang.Object
  |
  +--xbn.XBNObject
Direct Known Subclasses:
AOOValid, AOOVConfig, AOSLHashtable, AOSLookup, ArrayProtector, BinarySearchData, CAConfig, CompareArrays, ConfigReader, CRCDelimiters, CRConfig, CRCVariable, CRCVTrim, CRCVUnescape, CRLAObjects, CRLineAnalyzer, DBConnDirect, DBConnStatement, DirFile, DirScan, DSConfig, EscapeUnescapeString, ESConfig, ForLineRetrieval, GapConfig, GCIConfig, GetTemplateFrom, JDFile, ListPA, LPAConfig, ManualNamedArray, MsgFormat, NamedArray, OConfig, OGConfig, Outputter, OWriter, PackageType, PadChopString, PARDupNullLen, PARIElement, PAROrderDir, PARSContain, PARSElement, PAViolation, PCSConfig, PrimitiveArrayRule, QueryBase, Range, RangeConfig, ReportBadJDLinkCodes, SpcfcCfgChop, SpcfcCfgIfNull, SpcfcCfgPad, SplitLinkCode, StringOrBuffer, TALConfig, TConfigDefaults, Template, TemplateData, TemplateDataOrString, TemplateFiller, TemplateLineAnalyzer, TimerUnits, TLAObjects, TParseConfig, TrimChars, USCIgnore, UtilArray, UtilChar, UtilCommandLine, UtilConfig, UtilDate, UtilGap, UtilInt, Utility, UtilJDLCode, UtilNamed, UtilOutput, UtilPHFromObj, UtilSOB, UtilTemplate, VectorWrapper, XBNLocked, XBNStatic

public abstract class XBNObject
extends Object

The base class for all things xbn. Has standardized functions that throw exceptions and generate standard error messages, as well as a few other useful things.

Source code:  XBNObject.java.  Unit tests:  xbn_junit.JUTXBNObject.java.


Field Summary
protected static boolean bFALSE_IN_PRODUCTION
          Are "false" sanity checks on?
protected static boolean bTRUE_IN_PRODUCTION
          Are "true" sanity checks on?
protected static String sCNSTR
          The string 'constructor', to save a bit of memory.
protected static String sES
          The empty string, to save a bit of memory.
protected static String sLINE_SEP
          The line separator appropriate for this environment.
 
Constructor Summary
XBNObject()
           
 
Method Summary
static String getXMsgPrefix()
          Get the prefix used in exception messages.
protected static void sop(String s_message)
          Print a line of output to standard out.
protected static void sopl()
          Print a newline only to standard out.
protected static void sopl(String s_message)
          Print a line of output to standard out.
protected  void throwAX(String s_funcMsg)
          Throw an AssertException.
protected  void throwAXIfBadStr(String s_tr, String s_stringName, String s_callingFunc)
          If the provided String is null or zero characters in length, throw an exception.
protected  void throwAXIfNull(Object o_bject, String s_objectName, String s_callingFunc)
          If the provided Object is null, throw an exception.
protected  void throwAXSpoof(String s_classFuncMsg)
          Throw an AssertException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bTRUE_IN_PRODUCTION

protected static final boolean bTRUE_IN_PRODUCTION

Are "true" sanity checks on?

During development only, when extra checks are desired to ensure things are working as they should, set this to false. Must be true in production.

Note: There are also some select "SANITY CHECK"-s throughout the xbn packages that need to be commented out during production.

Equal to true


bFALSE_IN_PRODUCTION

protected static final boolean bFALSE_IN_PRODUCTION

Are "false" sanity checks on?

During development only, when extra checks are desired to ensure things are working as they should, set this to true. Must be false in production.

Note: There are also some select "SANITY CHECK"-s throughout the xbn packages that need to be commented out during production.

Equal to false


sLINE_SEP

protected static final String sLINE_SEP

The line separator appropriate for this environment.

Hardcoding "\n" (for instance) into your class' strings is not portable. This is.

Equal to System.getProperty("line.separator", "\n")


sES

protected static final String sES

The empty string, to save a bit of memory. Use this instead of creating an empty string explicitely.

Equal to ""


sCNSTR

protected static final String sCNSTR

The string 'constructor', to save a bit of memory. Use this instead of creating the string explicitely. There is no need to use this except when creating a string entirely equaling 'constructor'.

Constructor Detail

XBNObject

public XBNObject()
Method Detail

sopl

protected static final void sopl(String s_message)

Print a line of output to standard out.

Equal to System.out.println(s_message)

Parameters:
s_message - The message to output.

sop

protected static final void sop(String s_message)

Print a line of output to standard out.

Equal to System.out.print(s_message)

Parameters:
s_message - The message to output.

sopl

protected static final void sopl()

Print a newline only to standard out.

Equal to System.out.println()


throwAX

protected final void throwAX(String s_funcMsg)

Throw an AssertException.

Equal to throwAXSpoof(this.getClass().getName() + "." + s_funcMsg)


throwAXSpoof

protected final void throwAXSpoof(String s_classFuncMsg)

Throw an AssertException.

Equal to throw new AssertException(getXMsgPrefix() + s_classFuncMsg)

Parameters:
s_classFuncMsg - The name of the calling class, calling function, and the body of the error message.

throwAXIfNull

protected final void throwAXIfNull(Object o_bject,
                                   String s_objectName,
                                   String s_callingFunc)

If the provided Object is null, throw an exception.

If o_bject is non-null, then this function does nothing. Otherwise, this is equal to

throwAX(s_callingFunc + ": " + s_objectName + " is null.")

Parameters:
o_bject - The Object to analyze for null-ness.
s_objectName - The name of the object, for the potential error message only.
s_callingFunc - The name of the function from which the (potential) error message should appear that it is being thrown from.

throwAXIfBadStr

protected final void throwAXIfBadStr(String s_tr,
                                     String s_stringName,
                                     String s_callingFunc)

If the provided String is null or zero characters in length, throw an exception.

If s_tr is non-null and at least one character in length, then this function does nothing. Otherwise, an exception is thrown, describing the specific error.

Parameters:
s_tr - The string to analyze for null-ness and empty-ness.
s_stringName - The name of the string, for the potential error message only.
s_callingFunc - The name of the function from which the (potential) error message should appear that it is being thrown from.

getXMsgPrefix

public static final String getXMsgPrefix()

Get the prefix used in exception messages.

Returns:
"ERROR in "



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