xbn.config
Class CRCVariable

java.lang.Object
  |
  +--xbn.XBNObject
        |
        +--xbn.config.CRCVariable

public class CRCVariable
extends XBNObject

Configuration related to variables in a ConfigReader, provided via CRConfig. Provided to ConfigReader via CRConfig.

Source code:  CRCVariable.java


Fields inherited from class xbn.XBNObject
bFALSE_IN_PRODUCTION, bTRUE_IN_PRODUCTION, sCNSTR, sES, sLINE_SEP
 
Constructor Summary
CRCVariable()
          Create a CRCVariable with default settings.
CRCVariable(boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim, boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim, CRCVUnescape crcv_unescape)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim, CRCVUnescape crcv_unescape, boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim, CRCVUnescape crcv_unescape, String s_nullValue)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim, CRCVUnescape crcv_unescape, String s_nullValue, boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim, String s_nullValue)
          Create a CRCVariable.
CRCVariable(CRCVTrim crcv_trim, String s_nullValue, boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
CRCVariable(CRCVUnescape crcv_unescape)
          Create a CRCVariable.
CRCVariable(CRCVUnescape crcv_unescape, boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
CRCVariable(CRCVUnescape crcv_unescape, String s_nullValue)
          Create a CRCVariable.
CRCVariable(CRCVUnescape crcv_unescape, String s_nullValue, boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
CRCVariable(String s_nullValue)
          Create a CRCVariable.
CRCVariable(String s_nullValue, boolean b_1stLineWSIsEmptyString)
          Create a CRCVariable.
 
Method Summary
 CRCVTrim getCRCVTrim()
          Get the CRCVTrim for direct manipulation.
 CRCVUnescape getCRCVUnescape()
          Get the CRCVUnescape for direct manipulation.
 String getNullValue()
          Get the special string defined as null.
 boolean is1stLineWSEmptyString()
          If the first line of a variable's value is nothing but whitespace, should it be considered as empty string?
 String toString()
          Get some information about this CRCVariable.
 
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

CRCVariable

public CRCVariable()

Create a CRCVariable with default settings.

Equal to CRCVariable(new CRCVTrim())


CRCVariable

public CRCVariable(CRCVTrim crcv_trim)

Create a CRCVariable.

Equal to CRCVariable(crcv_trim, (new CRCVUnescape()))


CRCVariable

public CRCVariable(CRCVUnescape crcv_unescape)

Create a CRCVariable.

Equal to CRCVariable((new CRCVTrim()), crcv_unescape)


CRCVariable

public CRCVariable(String s_nullValue)

Create a CRCVariable.

Equal to CRCVariable((new CRCVTrim()), s_nullValue)


CRCVariable

public CRCVariable(boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

Equal to CRCVariable((new CRCVTrim()), b_1stLineWSIsEmptyString)


CRCVariable

public CRCVariable(CRCVTrim crcv_trim,
                   CRCVUnescape crcv_unescape)

Create a CRCVariable.

Equal to CRCVariable(crcv_trim, crcv_unescape, "__NULL__")


CRCVariable

public CRCVariable(CRCVTrim crcv_trim,
                   String s_nullValue)

Create a CRCVariable.

Equal to CRCVariable(crcv_trim, (new CRCVUnescape()), s_nullValue)


CRCVariable

public CRCVariable(CRCVTrim crcv_trim,
                   boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

Equal to CRCVariable(crcv_trim, (new CRCVUnescape()), b_1stLineWSIsEmptyString)


CRCVariable

public CRCVariable(CRCVUnescape crcv_unescape,
                   String s_nullValue)

Create a CRCVariable.

Equal to CRCVariable((new CRCVTrim()), crcv_unescape, s_nullValue)


CRCVariable

public CRCVariable(CRCVUnescape crcv_unescape,
                   boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

Equal to CRCVariable((new CRCVTrim()), crcv_unescape, b_1stLineWSIsEmptyString)


CRCVariable

public CRCVariable(String s_nullValue,
                   boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

Equal to CRCVariable((new CRCVTrim()), s_nullValue, b_1stLineWSIsEmptyString)


CRCVariable

public CRCVariable(CRCVTrim crcv_trim,
                   CRCVUnescape crcv_unescape,
                   String s_nullValue)

Create a CRCVariable.

Equal to CRCVariable(crcv_trim, crcv_unescape, s_nullValue, true)


CRCVariable

public CRCVariable(CRCVTrim crcv_trim,
                   CRCVUnescape crcv_unescape,
                   boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

Equal to CRCVariable(crcv_trim, crcv_unescape, "__NULL__", b_1stLineWSIsEmptyString)


CRCVariable

public CRCVariable(CRCVTrim crcv_trim,
                   String s_nullValue,
                   boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

Equal to CRCVariable(crcv_trim, (new CRCVUnescape()), "__NULL__", b_1stLineWSIsEmptyString)


CRCVariable

public CRCVariable(CRCVUnescape crcv_unescape,
                   String s_nullValue,
                   boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

Equal to CRCVariable((new CRCVTrim()), crcv_unescape, s_nullValue, b_1stLineWSIsEmptyString)


CRCVariable

public CRCVariable(CRCVTrim crcv_trim,
                   CRCVUnescape crcv_unescape,
                   String s_nullValue,
                   boolean b_1stLineWSIsEmptyString)

Create a CRCVariable.

This object, as a whole, is provided to the CRConfig constructor. Some of these requirements are enforced there, some here.

Regarding these characters:

They must all be unique, not invisible, and crcv_unescape.getUSCIgnore().isSpcfcIgnored(THE_CHAR) must equal false.

Parameters:
crcv_trim - Configuration regarding trimming the name and value lines. May not be null. See getCRCVTrim.
crcv_unescape - Configuration regarding what and how characters should be unescaped. May not be null. See getCRCVUnescape.
s_nullValue - The special string to be defined as (truly) null, when the first line of a value is equal to it. May not be null or zero characters in length. See getNullValue.
b_1stLineWSIsEmptyString - If the first line of a variable's value is nothing but whitespace, should it be considered as empty string? See is1stLineWSEmptyString.
Method Detail

getCRCVTrim

public final CRCVTrim getCRCVTrim()

Get the CRCVTrim for direct manipulation.

Returns:
crcv_trim Exactly as provided to the constructor.

getCRCVUnescape

public final CRCVUnescape getCRCVUnescape()

Get the CRCVUnescape for direct manipulation.

Returns:
crcv_unescape Exactly as provided to the constructor.

getNullValue

public final String getNullValue()

Get the special string defined as null.

When the first line of the value of a variable is equal to this, the value is equal to null.

How to make a value literally equal to this string?

For the sake of this documentation section, assume this string and the special empty string character equal their default values ("__NULL__" and '|', respectively).

To make a variable's value literally equal to "__NULL__", you must trim value lines (getCRCVTrim().doTrimVLs() must equal true).

If the empty string character is being used (getCRCVTrim().doUseESChar() equals true), set your variable's value equal to __NU\|LL__.

If the empty string character is not being used, set the second or subsequent line of the value equal to __NULL__. This method requires that is1stLineWSEmptyString equals false.

Returns:
s_nullValue Exactly as provided to the constructor.

is1stLineWSEmptyString

public final boolean is1stLineWSEmptyString()

If the first line of a variable's value is nothing but whitespace, should it be considered as empty string?

For example, take this variable:

name_of_variable1  =

This

is an "X":  x
and the
value "one":  1

name_of_variable2=  Value of 2

The first line of this variable's value is only spaces or tabs, or nothing (empty string). If this function returns true, you'll get a "stray text found" error, when CRLineAnalyzer attempts to process the "This" line.

If this function returns false, then the value is "...This...is...the...value of 1".

I personally prefer the former: The user gets an error. In order to make the first line of the value have whitespace only, configure CRCVTrim to trim value lines and to use the special empty string character:

name_of_variable1  =		|

This

is a pipe \|
and the
value of 1

For whitespace on the first line:

name_of_variable1  =		|   		|

This

is a pipe \|
and the
value of 1
Returns:
b_1stLineWSIsEmptyString Exactly as provided to the constructor.

toString

public String toString()

Get some information about this CRCVariable.

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