com.metamatrix.common.namedobject
Class IDVerifier

java.lang.Object
  extended by com.metamatrix.common.namedobject.IDVerifier

public class IDVerifier
extends java.lang.Object

This class contains several helper methods that check the validity of BaseID instances.

A BaseID is considered valid only if all of the following conditions are met:

  • The full name is at least one character long;
  • The first character of the full name is a letter; and
  • Each of the remaining characters of the full name is either is a letter, the MetadataID.DELIMITER_CHARACTER, a decimal digit, or the underscore character ('_').


    Field Summary
    static int ALL
              The result of a performCheck signifying that a character (other than the first character) contained a character that was a space.
    static int CONTAINS_INVALID_CHARACTER
              The result of a performCheck signifying that a character (other than the first character) contained a character that wasn't a letter, digit, underscore, space, or delimiter.
    static int CONTAINS_SPACE
              The result of a performCheck signifying that a character (other than the first character) contained a character that was a space.
    static char DELIMITER_CHARACTER
              The private character (in the form of char) that delimits the atomic components of the name
    static int FIRST_CHARACTER_IS_NOT_A_LETTER
              The result of a performCheck signifying that the first character of the full name is not a letter.
    static int NONE
              The result of a performCheck signifying that the full name is valid.
    static char UNDERSCORE_CHARACTER
              The underscore character allowed in full names anywhere except for the first character.
    static int ZERO_LENGTH_FULL_NAME
              The result of a performCheck signifying that the full name was zero-length.
     
    Constructor Summary
    IDVerifier()
               
     
    Method Summary
    static boolean isValid(BaseID id)
              Method to determine whether a BaseID has a valid full name.
    static int performCheck(BaseID id)
              Method to determine whether a MetadataID has a valid full name, and, if not valid, to identify why it is invalid.
    static int performCheck(java.lang.String fullName)
               
    static int performCheck(java.lang.String fullName, int levels)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    UNDERSCORE_CHARACTER

    public static final char UNDERSCORE_CHARACTER
    The underscore character allowed in full names anywhere except for the first character.

    See Also:
    Constant Field Values

    DELIMITER_CHARACTER

    public static final char DELIMITER_CHARACTER
    The private character (in the form of char) that delimits the atomic components of the name

    See Also:
    Constant Field Values

    NONE

    public static final int NONE
    The result of a performCheck signifying that the full name is valid.

    See Also:
    Constant Field Values

    ZERO_LENGTH_FULL_NAME

    public static final int ZERO_LENGTH_FULL_NAME
    The result of a performCheck signifying that the full name was zero-length.

    See Also:
    Constant Field Values

    FIRST_CHARACTER_IS_NOT_A_LETTER

    public static final int FIRST_CHARACTER_IS_NOT_A_LETTER
    The result of a performCheck signifying that the first character of the full name is not a letter.

    See Also:
    Constant Field Values

    CONTAINS_INVALID_CHARACTER

    public static final int CONTAINS_INVALID_CHARACTER
    The result of a performCheck signifying that a character (other than the first character) contained a character that wasn't a letter, digit, underscore, space, or delimiter.

    See Also:
    Constant Field Values

    CONTAINS_SPACE

    public static final int CONTAINS_SPACE
    The result of a performCheck signifying that a character (other than the first character) contained a character that was a space.

    See Also:
    Constant Field Values

    ALL

    public static final int ALL
    The result of a performCheck signifying that a character (other than the first character) contained a character that was a space.

    See Also:
    Constant Field Values
    Constructor Detail

    IDVerifier

    public IDVerifier()
    Method Detail

    isValid

    public static boolean isValid(BaseID id)
    Method to determine whether a BaseID has a valid full name. This method is primarily a utility method used within the Configuration Service; it is anticipated that this method does not need to be used by other components, since all components (other than those within Metadata Service) are able to create only valid IDs.

    Parameters:
    id - the BaseID that is to be checked for validity
    Returns:
    true if the specified BaseID is valid, or false otherwise
    Throws:
    java.lang.IllegalArgumentException - if the BaseID reference is null.

    performCheck

    public static int performCheck(BaseID id)
    Method to determine whether a MetadataID has a valid full name, and, if not valid, to identify why it is invalid. This method is primarily a utility method used within the Metadata Service; it is anticipated that this method does not need to be used by other components, since all components (other than those within Metadata Service) are able to create only valid IDs.

    Parameters:
    id - the BaseID that is to be checked for validity
    Returns:
    true if the specified MetadataID is valid, or false otherwise
    Throws:
    java.lang.IllegalArgumentException - if the MetadataID reference is null.

    performCheck

    public static int performCheck(java.lang.String fullName)

    performCheck

    public static int performCheck(java.lang.String fullName,
                                   int levels)


    Copyright © 2009. All Rights Reserved.