com.ibm.etools.iseries.rse.ui.validators
Class ValidatorIBMiObject
java.lang.Object
com.ibm.etools.iseries.rse.ui.validators.ValidatorIBMiObject
- All Implemented Interfaces:
- IIBMiMessageIDs
- Direct Known Subclasses:
- ValidatorCompileMemberType, ValidatorIBMiFile, ValidatorIBMiJobD, ValidatorIBMiJobName, ValidatorIBMiJobNumber, ValidatorIBMiJobUser, ValidatorIBMiLibrary, ValidatorIBMiMember, ValidatorIBMiMemberType, ValidatorIBMiModule, ValidatorIBMiMsgFile, ValidatorIBMiProgram, ValidatorQSYSAspDev, ValidatorQSYSAutList, ValidatorQSYSCCSIDValue, ValidatorQSYSCommandName, ValidatorQSYSDataArea, ValidatorQSYSDataQ, ValidatorQSYSMsgFile, ValidatorQSYSObjectAttr, ValidatorQSYSObjectType
public class ValidatorIBMiObject
- extends Object
- implements IIBMiMessageIDs
This class is used in dialogs that prompt for an object name.
This does basic validation, but offers a single place to enhance that checking
should we decide to.
We are now using a new algorithm for error checking that handles the variant
characters allowed in IBM i names ('@', '#' and '$') by including all possible
variants of them. So, while an illegal name can still sneak through if the wrong
variant is used for the target ccsid, the chance is pretty small, and we never
do the worse outcome which is flag a valid name as not valid.
The naming rules for IBM i member, object, file and library names are as follows:
- Names must be 10 characters or less.
- The special values of *LIBL and *CURLIB are valid for library names.
- If the name is not enclosed in double quotes ("):
- the first character must be alphabetic (A through Z, @, $, and #).
- the remaining characters must be alphanumeric (A through Z, 0 through 9,
and @, $, period (.), and underscore (_)).
- If the name is enclosed in double quotes, it is an extended name and any
characters are valid between the quotes except *, ?, ', ", and hex 00 through 3F or FF.
Fields inherited from interface com.ibm.etools.iseries.rse.ui.IIBMiMessageIDs |
FILEMSG_CREATE_RESOURCE_NOTVISIBLE, MSG_2PHASE_SAVE_NO_COPY, MSG_2PHASE_SAVE_NO_CREATE, MSG_2PHASE_SAVE_NO_DELETE, MSG_2PHASE_SAVE_NO_UPLOAD, MSG_ASPDEVNAME_EMPTY, MSG_ASPDEVNAME_NOTVALID, MSG_AUTLNAME_EMPTY, MSG_AUTLNAME_NOTVALID, MSG_CANNOT_POSITION_TO_LINE, MSG_CCSID_EMPTY, MSG_CCSID_NOTVALID, MSG_CMD_COMPLETED, MSG_CMD_DONEINTJOB, MSG_CMD_INTJOB_BUSY, MSG_CMD_MSGSNOTAVAIL, MSG_CMD_NO_CONNECTION, MSG_CMD_NO_INTJOB, MSG_CMD_NOMSGHELP, MSG_CMD_NOMSGS, MSG_CMD_NOTRUN, MSG_CMD_SBMTOINTJOB, MSG_CMD_SUBMITTED, MSG_CMDNAME_EMPTY, MSG_CMDNAME_NOTVALID, MSG_COMM_CACHE_NOT_AVAILABLE, MSG_COMM_CANNOT_FIND_PGM, MSG_COMM_CANNOT_FIND_SRVPGM, MSG_COMM_CANNOT_START_DEBUG_ROUTER, MSG_COMM_CANNOT_START_DEBUG_ROUTER_PORT, MSG_COMM_CANNOT_START_DEBUG_ROUTER_STARTED, MSG_COMM_CANNOT_START_RAC, MSG_COMM_CANNOT_START_SERVER, MSG_COMM_CANNOT_STOP_DEBUG_ROUTER, MSG_COMM_CANNOT_STOP_RAC, MSG_COMM_CANNOT_STOP_SERVER, MSG_COMM_CODE_AUTHORITY, MSG_COMM_CODE_MUSTCLOSE, MSG_COMM_CODE_REG_ERROR, MSG_COMM_CONNECTION_ERROR, MSG_COMM_CONSOLE_IMPORT_CHOOSE, MSG_COMM_CONSOLE_IMPORT_CODESERVER_XML_PARSE_ERROR, MSG_COMM_CONSOLE_IMPORT_CONNECTION_NAME_EXISTS, MSG_COMM_CONSOLE_IMPORT_FVDCSEC_PARSE_ERROR, MSG_COMM_CONSOLE_IMPORT_FVDCSEC_READ_ERROR, MSG_COMM_CONSOLE_IMPORT_FVDCTCP_ACCESS_ERROR, MSG_COMM_CONSOLE_IMPORT_FVDCTCP_NO_FILE, MSG_COMM_CONSOLE_IMPORT_FVDCTCP_READ_ERROR, MSG_COMM_CONSOLE_IMPORT_IMPORT_ERROR, MSG_COMM_CONSOLE_IMPORT_LIBRARY_XML_READ_ERROR, MSG_COMM_CONSOLE_IMPORT_NO_PROFILE_ERROR, MSG_COMM_CONSOLE_IMPORT_SUMMARY, MSG_COMM_ERROR_BIND, MSG_COMM_ERROR_CLIENT_SECURITY, MSG_COMM_ERROR_JDK_MISSING, MSG_COMM_ERROR_RSESERVER_MISSING, MSG_COMM_ERROR_SERVER_SECURITY, MSG_COMM_GENERAL_IO_ERROR, MSG_COMM_HOST_PTF_MISSING, MSG_COMM_HOSTSVR_NOT_STARTED, MSG_COMM_IJOB_BUSY, MSG_COMM_IJOB_DISCONNECTED, MSG_COMM_LOCAL_SERVER_USED, MSG_COMM_MODULE_NOT_IN_PGM, MSG_COMM_MODULE_NOT_IN_SRVPGM, MSG_COMM_NEED_UPDATED_DEBUG_SERVER, MSG_COMM_NETWOR_INTERRUPTED, MSG_COMM_NETWORK_DOWN, MSG_COMM_NO_IJOB, MSG_COMM_OS400_VERSION_NOT_SUPPORTED, MSG_COMM_OUTSTANDING_REQ, MSG_COMM_OUTSTANDING_REQS, MSG_COMM_PGM_NO_DEBUG_DATA, MSG_COMM_PREF_INVALID_PWD_EXPIRATION, MSG_COMM_PREF_INVALID_WAIT_TIMEOUT, MSG_COMM_PTF_MISSING, MSG_COMM_REQUEST_NOT_RESPONDED, MSG_COMM_RQSHELL_PTF_MISSING, MSG_COMM_SRVPGM_NO_DEBUG_DATA, MSG_COMMAND_EMPTY, MSG_COMMAND_INTERACTIVE, MSG_COMMAND_NOTVALID, MSG_COMMAND_SBMJOB, MSG_COMMANDPARMS_EMPTY, MSG_COMMANDPARMS_NOTVALID, MSG_COMPILE_EVENTS_FILE_NOT_PROCESSED, MSG_COMPILE_MEMBER_NOT_PROCESSED, MSG_CONNECTION_COMMPROPERTIES, MSG_CONNECTION_PREFIX, MSG_CONSECUTIVE_SOSI, MSG_COPYLIBRARY_FAILED, MSG_COPYMEMBER_FAILED, MSG_COPYOBJECT_FAILED, MSG_CPA_IMPORT_ERROR_DURING_IMPORT, MSG_CPA_IMPORT_ERROR_READING_TYPES_FILE, MSG_CPA_IMPORT_SELECT_DIRECTORY, MSG_CPA_IMPORT_SPECIFY_CONNECTION_PROFILE, MSG_CPA_IMPORT_SUMMARY_OF_IMPORT, MSG_CPO_IMPORT_DEFAULT_HOST_MUST_BE_SPECIFIED, MSG_CPO_IMPORT_ERROR_DURING_IMPORT, MSG_CPO_IMPORT_FILE_IS_EMPTY, MSG_CPO_IMPORT_FILE_NOT_FOUND, MSG_CPO_IMPORT_FILE_PARSE_ERROR, MSG_CPO_IMPORT_FILE_READ_ERROR, MSG_CPO_IMPORT_FILTER_NAME_EXISTS, MSG_CPO_IMPORT_LIST_OF_FILTERS_IMPORTED, MSG_CPO_IMPORT_NO_FILTERS_TO_IMPORT, MSG_CPO_IMPORT_NO_PROFILE_EXISTS, MSG_CPO_IMPORT_NOT_VALID_CODE_PROJECT, MSG_CPO_IMPORT_PLEASE_ENTER_CPO_FILE, MSG_CPO_IMPORT_PROFILE_NAME_EXISTS, MSG_CPO_IMPORT_SELECT_PROJECT_FILE, MSG_CPO_IMPORT_SPECIFY_CONNECTION_PROFILE, MSG_CPO_IMPORT_SUMMARY_OF_OPERATIONS, MSG_DOWNLOAD_FAILED, MSG_DOWNLOAD_LOCK_NO_READ, MSG_DOWNLOAD_LOCK_NO_WRITE_DSPJOB, MSG_DTAARANAME_EMPTY, MSG_DTAARANAME_NOTVALID, MSG_DTAQNAME_EMPTY, MSG_DTAQNAME_NOTVALID, MSG_DTV_DELETE_ERROR, MSG_DTV_DELETE_REC_MISSING, MSG_DTV_EXCEEDS_FLD_LENGTH, MSG_DTV_FIELD_ATTR_NOT_SUPPORT, MSG_DTV_FILE_EMPTY, MSG_DTV_FILE_OPEN_ERROR, MSG_DTV_FILE_READ_ERROR, MSG_DTV_GET_FILE_INFO_ERROR, MSG_DTV_INVALID_CHAR, MSG_DTV_INVALID_DATETIME, MSG_DTV_INVALID_NUMBER, MSG_DTV_RECORD_NOT_FOUND, MSG_DTV_UPDATE_FILE_OPEN_ERROR, MSG_ERROR_UNEXPECTED, MSG_FILENAME_EMPTY, MSG_FILENAME_NOTVALID, MSG_FLDNAME_EMPTY, MSG_FLDNAME_NOTVALID, MSG_GENERIC_ERROR, MSG_GENERICNAME_NOTVALID, MSG_IASPNAME_NOTVALID, MSG_IFS_SEQUENCE_NUMBERS, MSG_INVALID_HEX, MSG_JOB_NAME_EMPTY, MSG_JOB_NAME_NOTVALID, MSG_JOB_NUMBER_EMPTY, MSG_JOB_NUMBER_NOTVALID, MSG_JOB_PROPERTY_CHG_ERROR, MSG_JOB_PROPERTY_INVALID, MSG_JOB_STATUS_NOT_CHECKED, MSG_JOB_USER_EMPTY, MSG_JOB_USER_NOTVALID, MSG_JOBDNAME_EMPTY, MSG_JOBDNAME_NOTVALID, MSG_JOBMONITOR_REFRESH_HOUR, MSG_JOBMONITOR_REFRESH_HOURS, MSG_JOBMONITOR_REFRESH_MINUTE, MSG_JOBMONITOR_REFRESH_MINUTES, MSG_JOBMONITOR_REFRESH_NEVER, MSG_JOBMONITOR_REFRESH_SECONDS, MSG_LIB_EXISTS, MSG_LIB_NOTFOUND, MSG_LIB_NOTFOUND_CREATE, MSG_LIB_QTEMP_NOTALLOWED, MSG_LIBL_ALREADYCURLIB, MSG_LIBL_ALREADYONLIBL, MSG_LIBL_FILTER_ALREADY_EXISTS, MSG_LIBL_FILTER_QUESTION, MSG_LIBNAME_EMPTY, MSG_LIBNAME_NOTVALID, MSG_LISTRETRIEVAL_CANCELLED, MSG_LISTRETRIEVAL_FAILED, MSG_MBR_SEQUENCE_NUMBERS, MSG_MBR_SRCDTAREQUIRED, MSG_MBRNAME_EMPTY, MSG_MBRNAME_NOTVALID, MSG_MBRTYPE_DUPLICATE, MSG_MBRTYPE_GENERIC_EMPTY, MSG_MBRTYPE_GENERIC_NOTVALID, MSG_MBRTYPE_NOTUNIQUE, MSG_MBRTYPE_SCALAR_EMPTY, MSG_MBRTYPE_SCALAR_NOTVALID, MSG_MEMBER_NOT_FOUND, MSG_MODULENAME_EMPTY, MSG_MODULENAME_NOTVALID, MSG_MOVEMEMBER_FAILED, MSG_MOVEMEMBER_SAMEFILE, MSG_MOVEOBJECT_FAILED, MSG_MOVEOBJECT_SAMELIBRARY, MSG_MSGFILENAME_EMPTY, MSG_MSGFILENAME_NOTVALID, MSG_NEW_COMPILE_MAIN_COMMAND_EMPTY, MSG_NEW_COMPILE_MAIN_COMMAND_INTRO, MSG_NEW_COMPILE_MAIN_DESC, MSG_NEW_COMPILE_MAIN_NAME_DUPLICATE, MSG_NEW_COMPILE_MAIN_NAME_EMPTY, MSG_NEW_COMPILE_MAIN_NAME_INTRO, MSG_NEWMBRTYPE_EMPTY, MSG_NEWMBRTYPE_INUSE, MSG_NFS_CREATE_DIR_QUESTION, MSG_NFS_DIR_NOT_CREATED, MSG_NFS_DISPLAY_ALL_LIB, MSG_NFS_ENTERNAME, MSG_NFS_ENTERNEWNAME, MSG_NFS_ENTERTYPE, MSG_NFS_INVALID_SUBSET_ATTRIB, MSG_NFS_INVALID_SUBSET_NAME, MSG_NFS_INVALID_SUBSET_SIZE, MSG_NFS_INVALID_SUBSET_TYPE, MSG_NFS_INVALID_SUBSVAR, MSG_NFS_INVALIDCHARACTER, MSG_NFS_INVALIDNAME, MSG_NFS_INVALIDTYPE, MSG_NFS_MISSING_SUBSVAR, MSG_NFS_OVERWRITE_FILE_QUESTION, MSG_NFS_READONLY_FILE, MSG_NFS_TYPENOTFOUND, MSG_OBJATTR_EMPTY, MSG_OBJATTR_GENERIC_EMPTY, MSG_OBJATTR_GENERIC_NOTVALID, MSG_OBJATTR_NOTVALID, MSG_OBJATTR_SCALAR_EMPTY, MSG_OBJATTR_SCALAR_NOTVALID, MSG_OBJNAME_EMPTY, MSG_OBJNAME_NOTVALID, MSG_OBJTYPE_ALLALLNOTVALID, MSG_OBJTYPE_DUPLICATE, MSG_OBJTYPE_EMPTY, MSG_OBJTYPE_NOTUNIQUE, MSG_OBJTYPE_NOTVALID, MSG_OBJTYPEATTR_EMPTY, MSG_OBJTYPEATTR_NOTVALID, MSG_OFFLINE_CANT_CONNECT, MSG_OPEN_IN_EDITOR_NO_MEMBER, MSG_PASSWORD_GOING_TO_EXPIRE, MSG_PASSWORD_GOING_TO_EXPIRE_TOMORROW, MSG_PATH_PREFIX, MSG_PATHNAME_EMPTY, MSG_PGMNAME_EMPTY, MSG_PGMNAME_NOTVALID, MSG_PGMSRVPGMNAME_EMPTY, MSG_PGMSRVPGMNAME_NOTVALID, MSG_PREFIX, MSG_PROCEDURE, MSG_QUESTION_CRTLIB, MSG_RCDNAME_EMPTY, MSG_RCDNAME_NOTVALID, MSG_RECORD_LENGTH_EMPTY, MSG_RECORD_LENGTH_NOTVALID, MSG_RECORD_NF, MSG_REFLIB_REQUIRED, MSG_RPGWIZARD_CCSID_EMPTY, MSG_RPGWIZARD_CCSID_INVALID, MSG_RPGWIZARD_CLASS_EMPTY, MSG_SAVEAS_MEMBER_OPEN, MSG_SAVEFILE_CREATING, MSG_SAVEFILE_EXIST_NOTSAVF, MSG_SAVEFILE_EXIST_REPLACE, MSG_SAVEFILE_RESTORING, MSG_SAVEFILE_RSTLIB_EXISTS, MSG_SAVEFILE_UPLOAD_DONE, MSG_SBMJOB_PARMS_NOCMD, MSG_SBMJOB_PARMS_NOJOBD, MSG_SEARCH_COLUMNNUMBER_EMPTY, MSG_SEARCH_EVENTFILE_LOCKED, MSG_SEARCH_INPUT_BOTH, MSG_SEARCH_INPUT_NUMBER, MSG_SEARCH_INPUT_POSITIVE_NUMBER, MSG_SEARCH_RECORD_LENGTH, MSG_SEARCH_SEARCHSTRING_EMPTY, MSG_SEARCH_UNEXPECTED_ERROR, MSG_SIGNON_GENERAL_ERROR, MSG_SIGNON_PASSWORD_ERROR, MSG_SIGNON_PASSWORD_EXPIRED, MSG_SIGNON_PASSWORD_INCORRECT, MSG_SIGNON_PASSWORD_INCORRECT_USER_DISABLED, MSG_SIGNON_PASSWORD_NEW_VERIFY_MISMATCH, MSG_SIGNON_USERID_DISABLED, MSG_SIGNON_USERID_ERROR, MSG_SIGNON_USERID_INVALID, MSG_SRVPGMNAME_EMPTY, MSG_SRVPGMNAME_NOTVALID, MSG_STATUS_UPLOADING, MSG_STATUS_VERIFYING, MSG_SYNTAX_CHECK_ILERPG_DLLS_NOTLOADED, MSG_SYNTAX_CHECK_ILERPG_ERROR, MSG_SYNTAX_CHECK_ILERPG_OK, MSG_SYNTAX_CHECK_MORE_THAN_MAX_MSG, MSG_SYNTAX_CHECK_SQL_OFFLINE, MSG_TABLE_EXPORT_ERROR, MSG_TITLE, MSG_UNEPECTED_UNKNOWN, MSG_UNEXPCTED_UNEXPECTED, MSG_UPLOAD_LOCK_NO_READ, MSG_UPLOAD_LOCK_NO_WRITE, MSG_UPLOAD_LOCK_NO_WRITE_DSPJOB, MSG_UPLOAD_MEMBER_EXISTS, MSG_UPLOAD_NO_MEMBER, MSG_UPLOAD_NO_WRITE, MSG_USERID_EMPTY, MSG_USERID_NOTVALID, MSG_VERIFY_DLLS_NOTLOADED, MSG_VERIFY_ILERPG_COMM_BUSY, MSG_VERIFY_ILERPG_COMPILE_ERR, MSG_VERIFY_ILERPG_DLLS_NOTLOADED, MSG_VERIFY_ILERPG_IO_LISTFIL, MSG_VERIFY_ILERPG_LOW_SEVERITY, MSG_VERIFY_ILERPG_NO_MEMORY, MSG_VERIFY_ILERPG_OK, MSG_VERIFY_ILERPG_OPEN_LISTFIL, MSG_VERIFY_ILERPG_STOP_KEY_PRESSED, MSG_VERIFY_ILERPG_SYSERR, PLUGIN_ID, PREFIX, RESID_PREFIX |
Constructor Summary |
ValidatorIBMiObject()
Constructor when an emptry string is not allowed, and generic names are allowed. |
ValidatorIBMiObject(boolean isEmptyAllowed,
boolean isGenericAllowed)
Constructor |
Method Summary |
static boolean |
containsBadCharacters(char newChar,
StringBuffer badChars)
Return true if the given character is one of the given invalid characters. |
static boolean |
containsBadCharacters(String newText,
StringBuffer badChars)
Return true if the given string contains any of the given invalid characters. |
static boolean |
containsBadCharacters(String newText,
StringBuffer badChars,
int startingPos)
Return true if the given string contains any of the given invalid characters. |
SystemMessage |
getEmptyMessage()
|
String[] |
getExistingNamesList()
Return the existing names list. |
SystemMessage |
getInvalidMessage(String substitutionString)
|
int |
getMaximumNameLength()
Return the max length for iSeries objects: 10
Child classes override by setting maxLength. |
SystemMessage |
getNotUniqueMessage(String substitutionString)
|
boolean |
getQuotesAllowed()
Return if quoted names are allowed. |
SystemMessage |
getSystemMessage()
When isValid returns non-null, call this to get the SystemMessage object for the error
versus the simple string message. |
protected String |
getSystemMessageText(SystemMessage msg)
Helper method to set the current system message and return its level one text |
boolean |
isEmptyAllowed()
Return if empty names are allowed. |
boolean |
isGenericAllowed()
Return if generic names are allowed. |
static boolean |
isNumeric(String newText)
Return true if the given string is all numeric, containing only digits 0-9, starting
the search at the first character of the given input string. |
static boolean |
isNumeric(String newText,
int startingPos)
Return true if the given string is all numeric, containing only digits 0-9, starting
the search at the given offset into the input string. |
static boolean |
isOneOf(char testChar,
StringBuffer charSet)
Return true if the given character is in the given character set. |
static boolean |
isQuoted(String name)
Returns true if given name is a quoted or extended name. |
SystemMessage |
isSyntaxOk(String newText)
Overridable entry point. |
String |
isValid(Object newValue)
As required by ICellEditor. |
String |
isValid(String newText)
Called to do verification of user-entered text. |
static boolean |
onlyContains(String newText,
StringBuffer charSet)
Return true if the given string only contains characters in the given character set,
starting the search at the first character of the given input string. |
static boolean |
onlyContains(String newText,
StringBuffer charSet,
int startingPos)
Return true if the given string only contains characters in the given character set,
starting the search at the given offset into the input string. |
ValidatorIBMiObject |
reset()
Clear previously specified configuration information. |
void |
setCaseSensitive(boolean caseSensitive)
Reset whether this is a case-sensitive list or not. |
ValidatorIBMiObject |
setEmptyAllowed(boolean allowed)
Set if empty names are allowed. |
void |
setExistingNamesList(Collection existingList)
Set a list of existing names if this is available. |
void |
setExistingNamesList(String[] names)
Set a list of existing names if this is available. |
ValidatorIBMiObject |
setGenericAllowed(boolean allowed)
Set if generic names are allowed. |
ValidatorIBMiObject |
setQuotesAllowed(boolean allowed)
Set if quoted names are allowed. |
SystemMessage |
validate(String text)
For convenience, this is a shortcut to calling: |
boolean |
wasQuoted()
Returns true if the last name passed into isValid(String) was quoted. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Copyright
public static final String Copyright
- See Also:
- Constant Field Values
MAX_OBJNAME_LENGTH
public static final int MAX_OBJNAME_LENGTH
- See Also:
- Constant Field Values
EMPTY_ALLOWED_NO
public static final boolean EMPTY_ALLOWED_NO
- See Also:
- Constant Field Values
EMPTY_ALLOWED_YES
public static final boolean EMPTY_ALLOWED_YES
- See Also:
- Constant Field Values
VARIANTS
public static final String VARIANTS
- This is a all possible codepage translations from EBCDIC to UCS-2, for the
famous three variant characters @,$ and #.
- See Also:
- Constant Field Values
VALIDCHARS_FIRSTPOS
public static final StringBuffer VALIDCHARS_FIRSTPOS
- All valid characters for the first char of an iSeries name, using VARIANTS for the
$, @ and # characters.
VALIDCHARS_ENDPOS
public static final StringBuffer VALIDCHARS_ENDPOS
- All valid characters for the non-first chars of an iSeries name, using VARIANTS for the
$, @ and # characters.
isEmptyAllowed
protected boolean isEmptyAllowed
isGenericAllowed
protected boolean isGenericAllowed
wasQuoted
protected boolean wasQuoted
areQuotesAllowed
protected boolean areQuotesAllowed
msg_Invalid
protected SystemMessage msg_Invalid
msg_Empty
protected SystemMessage msg_Empty
msg_NotUnique
protected SystemMessage msg_NotUnique
currentMessage
protected SystemMessage currentMessage
maxLength
protected int maxLength
INVARIANTS
protected static final String INVARIANTS
- See Also:
- Constant Field Values
specialCharsNumeric
protected static final StringBuffer specialCharsNumeric
specialCharsExtended
protected StringBuffer specialCharsExtended
uniqueNameValidator
protected ValidatorUniqueString uniqueNameValidator
DEFAULT_SINGLETON
public static ValidatorIBMiObject DEFAULT_SINGLETON
- To save memory we have a singleton of a very-often used configuration.
This does not allow empty strings or generic names.
ValidatorIBMiObject
public ValidatorIBMiObject()
- Constructor when an emptry string is not allowed, and generic names are allowed.
ValidatorIBMiObject
public ValidatorIBMiObject(boolean isEmptyAllowed,
boolean isGenericAllowed)
- Constructor
- Parameters:
isEmptyAllowed
- true if an empty string is validisGenericAllowed
- true if one or more asterisks are allowed in the name
reset
public ValidatorIBMiObject reset()
- Clear previously specified configuration information. Useful when re-using validators.
setEmptyAllowed
public ValidatorIBMiObject setEmptyAllowed(boolean allowed)
- Set if empty names are allowed. If true, an null or zero-length name is not
considered an error.
- Returns:
- this so you return xxx.setYYY(...)
setGenericAllowed
public ValidatorIBMiObject setGenericAllowed(boolean allowed)
- Set if generic names are allowed. If true, the validity of the generic syntax is not
checked, but at least the '*' character is permitted.
- Returns:
- this so you return xxx.setYYY(...)
setQuotesAllowed
public ValidatorIBMiObject setQuotesAllowed(boolean allowed)
- Set if quoted names are allowed. This is used by subclasses for things like member types.
- Returns:
- this so you return xxx.setYYY(...)
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive)
- Reset whether this is a case-sensitive list or not.
This is a no-op and only here to satisfy an interface we implement.
setExistingNamesList
public void setExistingNamesList(String[] names)
- Set a list of existing names if this is available. Validator will ensure none of those
names are selected.
setExistingNamesList
public void setExistingNamesList(Collection existingList)
- Set a list of existing names if this is available. Validator will ensure none of those
names are selected.
getExistingNamesList
public String[] getExistingNamesList()
- Return the existing names list. This will be a case-normalized and sorted list.
isQuoted
public static boolean isQuoted(String name)
- Returns true if given name is a quoted or extended name.
containsBadCharacters
public static boolean containsBadCharacters(String newText,
StringBuffer badChars)
- Return true if the given string contains any of the given invalid characters.
- Parameters:
badChar
- illegar characters to search forstartingPos
- zero-based starting position of input string to start search at
containsBadCharacters
public static boolean containsBadCharacters(String newText,
StringBuffer badChars,
int startingPos)
- Return true if the given string contains any of the given invalid characters.
- Parameters:
newText
- input string to searchbadChar
- illegar characters to search forstartingPos
- zero-based starting position of input string to start search at
containsBadCharacters
public static boolean containsBadCharacters(char newChar,
StringBuffer badChars)
- Return true if the given character is one of the given invalid characters.
isNumeric
public static boolean isNumeric(String newText)
- Return true if the given string is all numeric, containing only digits 0-9, starting
the search at the first character of the given input string.
- Parameters:
newText
- input string to search
isNumeric
public static boolean isNumeric(String newText,
int startingPos)
- Return true if the given string is all numeric, containing only digits 0-9, starting
the search at the given offset into the input string.
- Parameters:
newText
- input string to searchstartingPos
- zero-based starting position of input string to start search at
onlyContains
public static boolean onlyContains(String newText,
StringBuffer charSet)
- Return true if the given string only contains characters in the given character set,
starting the search at the first character of the given input string.
- Parameters:
newText
- input string to searchcharSet
- characters to test input only contains
onlyContains
public static boolean onlyContains(String newText,
StringBuffer charSet,
int startingPos)
- Return true if the given string only contains characters in the given character set,
starting the search at the given offset into the input string.
- Parameters:
newText
- input string to searchcharSet
- characters to test input only containsstartingPos
- zero-based starting position of input string to start search at
isOneOf
public static boolean isOneOf(char testChar,
StringBuffer charSet)
- Return true if the given character is in the given character set.
- Parameters:
testChar
- input character to searchcharSet
- characters to test input only contains
wasQuoted
public boolean wasQuoted()
- Returns true if the last name passed into
isValid(String)
was quoted.
isSyntaxOk
public SystemMessage isSyntaxOk(String newText)
- Overridable entry point. Called after other base checking succeeds.
Override in child to do your own syntax checking.
- Parameters:
newText
- the input text to be verified
- Returns:
- A error message if the verify failed, or null if it is successful.
isEmptyAllowed
public boolean isEmptyAllowed()
- Return if empty names are allowed. If true, an null or zero-length name is not
considered an error.
isGenericAllowed
public boolean isGenericAllowed()
- Return if generic names are allowed. If true, the validity of the generic syntax is not
checked, but at least the '*' character is permitted.
getQuotesAllowed
public boolean getQuotesAllowed()
- Return if quoted names are allowed. This is used by subclasses for things like member types.
getSystemMessageText
protected String getSystemMessageText(SystemMessage msg)
- Helper method to set the current system message and return its level one text
getMaximumNameLength
public int getMaximumNameLength()
- Return the max length for iSeries objects: 10
Child classes override by setting maxLength.
isValid
public String isValid(String newText)
- Called to do verification of user-entered text.
- Parameters:
newText
- the input text to be verified
- Returns:
- A error message string if the verify failed, or null if it is successful.
isValid
public String isValid(Object newValue)
- As required by ICellEditor.
Simply calls
isValid(String)
getSystemMessage
public SystemMessage getSystemMessage()
- When isValid returns non-null, call this to get the SystemMessage object for the error
versus the simple string message.
validate
public SystemMessage validate(String text)
- For convenience, this is a shortcut to calling:
if (isValid(text) != null)
msg = getSystemMessage();
getInvalidMessage
public SystemMessage getInvalidMessage(String substitutionString)
getEmptyMessage
public SystemMessage getEmptyMessage()
getNotUniqueMessage
public SystemMessage getNotUniqueMessage(String substitutionString)
Copyright © 2011 IBM Corp. All Rights Reserved.
Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.