com.ibm.as400.ui.util
Class AS400NameFormatter
java.lang.Object
|
+--com.ibm.as400.ui.framework.java.DataFormatter
|
+--com.ibm.as400.ui.util.AS400Formatter
|
+--com.ibm.as400.ui.util.AS400NameFormatter
- public class AS400NameFormatter
- extends AS400Formatter
Checks validity of a string as an AS/400 *NAME
.
Checks using the CCSID of the AS/400 specified in the constructor.
If parsing is unsuccessful, an IllegalUserDataException
is thrown.
An AS/400 *NAME
,
is also known as a Basic Name or Basic Name in Quoted Form.
A valid Basic Name is:
- 1 to n characters
- first character 'A'-'Z', '$', '#', '@'
- other characters 'A'-'Z', '0'-'9', '$', '#', '@', '.', '_'
A valid Basic Name in Quoted Form:
- starts and ends with " (double quote)
- All characters valid except: EBCDIC x00 - x3F, xFF,
'*', '?', " (double quote), ' (single quote), ' ' (blank)
The maximum length defaults to 256, but can be changed using setMaxLength
.
To check names to IBM object standard length, use setMaxLength(AS400Formatter.IBM_OBJECT_NAME_MAX_LENGTH)
)
In quoted form the quotes are counted as part of the total maximum length. For example, using a maximum length of 256, the maximum number of
usable characters in quoted form is 254.
Wild card processing is not defined for quoted form. If quoted form is detected, wild cards are treated as illegal
characters.
- Since:
- v4r2m0
- See Also:
IllegalUserDataException
,
AS400NameFormatter
,
AS400SnameFormatter
,
AS400CnameFormatter
,
AS400CharFormatter
,
AS400SQLNameFormatter
Method Summary |
int |
getMaxLength()
Gets the current number of characters allowed during checking. |
java.lang.Object |
parse(java.lang.String source)
Parses and checks a string as a valid AS/400 *NAME . |
void |
setMaxLength(int length)
Sets the maximum number of characters allowed during checking. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AS400NameFormatter
public AS400NameFormatter(AS400 system)
- Constructs an
AS400NameFormatter
.
The CCSID of the input AS400
object will be used for checking.
If a null AS400
object is used, 37 is used as a default CCSID.
- Parameters:
system
- an AS400
object.- Since:
- v4r2m0
parse
public java.lang.Object parse(java.lang.String source)
throws IllegalUserDataException
- Parses and checks a string as a valid AS/400
*NAME
.
If the string is not valid an IllegalUserDataException
is thrown.
- Overrides:
parse
in class DataFormatter
- Parameters:
source
- the string to be parsed- Returns:
- the valid checked result
- Since:
- v4r2m0
setMaxLength
public void setMaxLength(int length)
throws java.lang.IllegalArgumentException
- Sets the maximum number of characters allowed during checking. Names which exceed this length
cause an exception to be thrown. If not set, the default length is 256. To check IBM object names,
use the
IBM_OBJECT_NAME_MAX_LENGTH
constant.
- Parameters:
length
- the maximum number of characters allowed- Since:
- v5r1m0
- See Also:
AS400Formatter.IBM_OBJECT_NAME_MAX_LENGTH
,
AS400Formatter.STANDARD_OBJECT_NAME_MAX_LENGTH
getMaxLength
public int getMaxLength()
- Gets the current number of characters allowed during checking. Names which exceed this length
cause an exception to be thrown.
- Returns:
- length the maximum number of characters allowed
- Since:
- v5r1m0