com.ibm.as400.ui.util
Class AS400Formatter

java.lang.Object
  extended by com.ibm.as400.ui.framework.java.DataFormatter
      extended by com.ibm.as400.ui.util.AS400Formatter
Direct Known Subclasses:
AS400CharFormatter, AS400CnameFormatter, AS400CnameIBMFormatter, AS400MessageIdFormatter, AS400NameFormatter, AS400NameIBMFormatter, AS400SnameFormatter, AS400SnameIBMFormatter, AS400SQLNameColumnFormatter, AS400SQLNameFormatter

public abstract class AS400Formatter
extends DataFormatter

This abstract class provides common function for the AS/400 Formatter classes. AS/400 Formatters check strings to assure they meet common AS/400 naming standards.

Asterisk "*" wild cards are not allowed by default, but may be allowed by using setWildCardMode.

Since:
v4r2m0
Version:
1.1, 01/07/00
Author:
B. Cragun
See Also:
IllegalUserDataException, AS400NameFormatter, AS400SnameFormatter, AS400CnameFormatter, AS400CharFormatter, AS400SQLNameFormatter, AS400SQLNameColumnFormatter

Field Summary
Modifier and Type Field and Description
static int ALLOW_EMBEDDED_WILD_CARDS
          Mode value indicating the that the formatter is to allow wild cards wherever and as often as they occur.
static int ALLOW_TRAILING_WILD_CARD
          Mode value indicating the that the formatter is only to allow wild cards at the end of the formatted string.
static int IBM_OBJECT_NAME_MAX_LENGTH
          Length constant representing the maximum length, 10, for IBM object names on the AS/400.
static int NO_WILD_CARDS
          Mode value indicating the that the formatter is not to allow wild cards.
static int STANDARD_OBJECT_NAME_MAX_LENGTH
          Length constant representing the maximum length, 256, for standard object names on the AS/400.
 
Constructor Summary
Constructor and Description
AS400Formatter(AS400 system)
          Constructs an AS400Formatter.
 
Method Summary
Modifier and Type Method and Description
 int getCCSID()
          Returns the current CCSID value.
 int getWildCardMode()
          Gets the Wild Card allowance used during checking.
protected  boolean isAllowedWildCard(byte byteIn, boolean bLastChar)
          Common service for subclasses that determines if a byte is valid as a wild card.
protected  boolean isValidEbcdicAlpha(byte byteIn, int iCCSID)
          Common service for subclasses which determines if a byte is a valid EBCDIC character.
 void setCCSID(int iCCSID)
          Sets the current CCSID value to be used for checking.
 void setWildCardMode(int wildCardMode)
          Specifies whether Wild Cards should be allowed in checking.
 
Methods inherited from class com.ibm.as400.ui.framework.java.DataFormatter
format, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IBM_OBJECT_NAME_MAX_LENGTH

public static final int IBM_OBJECT_NAME_MAX_LENGTH
Length constant representing the maximum length, 10, for IBM object names on the AS/400. Convenience constant for subclasses which implement setMaxLength.

Since:
v5r1m0
See Also:
STANDARD_OBJECT_NAME_MAX_LENGTH, Constant Field Values

STANDARD_OBJECT_NAME_MAX_LENGTH

public static final int STANDARD_OBJECT_NAME_MAX_LENGTH
Length constant representing the maximum length, 256, for standard object names on the AS/400. Convenience constant for subclasses which implement setMaxLength.

Since:
v5r1m0
See Also:
IBM_OBJECT_NAME_MAX_LENGTH, Constant Field Values

NO_WILD_CARDS

public static final int NO_WILD_CARDS
Mode value indicating the that the formatter is not to allow wild cards.

Since:
v5r1m0
See Also:
ALLOW_TRAILING_WILD_CARD, ALLOW_EMBEDDED_WILD_CARDS, Constant Field Values

ALLOW_TRAILING_WILD_CARD

public static final int ALLOW_TRAILING_WILD_CARD
Mode value indicating the that the formatter is only to allow wild cards at the end of the formatted string. Wild cards are not valid in quoted strings.

Since:
v5r1m0
See Also:
NO_WILD_CARDS, ALLOW_EMBEDDED_WILD_CARDS, Constant Field Values

ALLOW_EMBEDDED_WILD_CARDS

public static final int ALLOW_EMBEDDED_WILD_CARDS
Mode value indicating the that the formatter is to allow wild cards wherever and as often as they occur. Wild cards are not valid in quoted strings.

Since:
v5r1m0
See Also:
NO_WILD_CARDS, ALLOW_TRAILING_WILD_CARD, Constant Field Values
Constructor Detail

AS400Formatter

public AS400Formatter(AS400 system)
Constructs an AS400Formatter. The CCSID of the input AS400 object is used for checking, unless the CCSID is specifically set by setCCSID. If a null AS400 object is used, 37 is used as a default CCSID.

Parameters:
system - the AS400 system object used for checking.
Since:
v4r2m0
Method Detail

isValidEbcdicAlpha

protected boolean isValidEbcdicAlpha(byte byteIn,
                                     int iCCSID)
Common service for subclasses which determines if a byte is a valid EBCDIC character. Handles special case Katakana CCSIDs.

Parameters:
byteIn - the byte to check.
iCCSID - the CCSID to use for checking.
Since:
v4r2m0

getCCSID

public int getCCSID()
Returns the current CCSID value. This value will be the CCSID of the AS/400 system object or the default CCSID, 37, if no system object is specified.

Returns:
the current CCSID value.
Since:
v4r2m0

setCCSID

public void setCCSID(int iCCSID)
Sets the current CCSID value to be used for checking. Overrides the CCSID value of the current AS/400 system.

Parameters:
iCCSID - the current CCSID value.
Since:
v4r2m0

setWildCardMode

public void setWildCardMode(int wildCardMode)
                     throws IllegalArgumentException
Specifies whether Wild Cards should be allowed in checking.

Parameters:
wildCardMode - the mode.
Throws:
IllegalArgumentException
Since:
v5r1m0
See Also:
NO_WILD_CARDS, ALLOW_TRAILING_WILD_CARD, ALLOW_EMBEDDED_WILD_CARDS

getWildCardMode

public int getWildCardMode()
Gets the Wild Card allowance used during checking.

Returns:
the mode.
Since:
v5r1m0
See Also:
NO_WILD_CARDS, ALLOW_TRAILING_WILD_CARD, ALLOW_EMBEDDED_WILD_CARDS

isAllowedWildCard

protected boolean isAllowedWildCard(byte byteIn,
                                    boolean bLastChar)
Common service for subclasses that determines if a byte is valid as a wild card. The caller decides if the byte is to be checked as the last character or not. Asterisk is the only allowed wild card.

Parameters:
byteIn - the byte to check.
bLastChar - true if the byte is to be checked as the last character.
Since:
v5r1m0