Package Torello.CSS

Class ClassNameCSSException

  • All Implemented Interfaces:
    java.io.Serializable

    public class ClassNameCSSException
    extends java.lang.RuntimeException
    An exception for using with a Validity-Check of a CSS Class-Name.

    Regular-Expression:
    The following is considered the validator for this exception's Validity-Checker method.

    Regular Expression:
    ^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$

    These are the most recent test results of applying this regular expression to a series of randomly selected Java Classes.
    @cloudshell:~$ java Torello.Test.Y2024.M09September.ClassNameExTest 
    "-validname":   true,  PASS
    "valid-name":   true,  PASS
    "-1invalid":    false, PASS
    "--invalid":    false, PASS
    "-valid":       true,  PASS
    "Good":         true,  PASS
    "9NoGood":      false, PASS
    "No Good":      false, PASS
    "999":          false, PASS
    "":             false, PASS
    "--invalid":    false, PASS
    "-2invalid":    false, PASS
    "inv@lid":      false, PASS
    "inv!lid":      false, PASS
    "123invalid":   false, PASS
    "-":            false, PASS
    "1":            false, PASS
    "A":            true,  PASS
    "-A":           true,  PASS
    
    See Also:
    VALID_CSS_CLASS_NAME, VALID_CSS_CLASS_NAME_PRED, Serialized Form


    • Field Detail

      • serialVersionUID

        🡇     🗕  🗗  🗖
        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Note that Java's java.lang.Exception and java.lang.Error classes implement the Serializable interface, and a warning-free build expects this field be defined here.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
        
      • VALID_CSS_CLASS_NAME

        🡅  🡇     🗕  🗗  🗖
        public static final java.util.regex.Pattern VALID_CSS_CLASS_NAME
        This is a validator regular-expression. It is intended to check whether or not a CSS Class-Name is valid or not.
        See Also:
        VALID_CSS_CLASS_NAME_PRED
        Code:
        Exact Field Declaration Expression:
         public static final Pattern VALID_CSS_CLASS_NAME =
                 // Pattern.compile("^([_a-zA-Z]|-[_a-zA-Z])[_\\-a-zA-Z0-9]*$");
                 Pattern.compile("^-?[_a-zA-Z]+[_a-zA-Z0-9-]*$");
        
      • VALID_CSS_CLASS_NAME_PRED

        🡅  🡇     🗕  🗗  🗖
        public static final java.util.function.Predicate<java.lang.String> VALID_CSS_CLASS_NAME_PRED
        This is the validator Reg-Ex after having been converted into a java.util.function.Predicate<String>.
        See Also:
        VALID_CSS_CLASS_NAME
        Code:
        Exact Field Declaration Expression:
         public static final Predicate<String> VALID_CSS_CLASS_NAME_PRED =
                 VALID_CSS_CLASS_NAME.asPredicate();
        
    • Constructor Detail

      • ClassNameCSSException

        🡅  🡇     🗕  🗗  🗖
        public ClassNameCSSException​(java.lang.String message)
        Constructs a ClassNameCSSException with the specified detail message.
        Parameters:
        message - the detail message.
      • ClassNameCSSException

        🡅  🡇     🗕  🗗  🗖
        public ClassNameCSSException​(java.lang.String message,
                                     java.lang.Throwable cause)
        Constructs a new exception with the specified detail message and cause.

        NOTE:

        The detail message associated with cause is not automatically incorporated into this exception's detail message.
        Parameters:
        message - The detail message (which is saved for later retrieval by the Throwable.getMessage() method).
        cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is non-existent or unknown.)
      • ClassNameCSSException

        🡅  🡇     🗕  🗗  🗖
        public ClassNameCSSException​(java.lang.Throwable cause)
        Constructs a new exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for exceptions that are little more than wrappers for other throwables.
        Parameters:
        cause - The cause (which is saved for later retrieval by the Throwable.getCause() method). (A null value is permitted, and indicates that the cause is non-existent or unknown.)
    • Method Detail

      • check

        🡅     🗕  🗗  🗖
        public static void check​(java.lang.String cssClassName)
        Checks if a the provided cssClassName is a valid name according the CSS Regular-Expression that's incorporated into this class.
        Parameters:
        cssClassName - Any Java-String, but only a valid CSS Class-Name can prevent this method from throwing this class' exception.
        Throws:
        ClassNameCSSException - if the provided cssClassName isn't a proper CSS Class-Name, according to the Regular-Expression Predicate VALID_CSS_CLASS_NAME_PRED
        java.lang.NullPointerException - if cssClassName is null, then NPE throws.
        See Also:
        VALID_CSS_CLASS_NAME, VALID_CSS_CLASS_NAME_PRED