Enum CIET

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CIET>

    public enum CIET
    extends java.lang.Enum<CIET>
    CIET: Class, Interface, Enumerated-Type, Annotation (@interface) or Java 17+ Record.

    CIET: Class, Interface or Enumerated-Type

    An Enumerated Type (enum) for identifying whether a java source code file is a Class, Interface or Enumerated Type.

    NOTE: Since Annotations are actually defined using the declaration @interface, the letter 'A' is not included in this acronym. Since records are much newer, and less common, well - they are also not included in the acronym.


    • Method Summary

       
      Convert String to Enum Constant
      Modifier and Type Method
      static CIET valueOf​(String name)
       
      List all Enum Constants
      Modifier and Type Method
      static CIET[] values()
       
      More Methods
      Modifier and Type Method
      static CIET get​(String name)
      String toString()
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        🡅  🡇     🗕  🗗  🗖
        public static CIET[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CIET c : CIET.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        🡅  🡇     🗕  🗗  🗖
        public static CIET valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • toString

        🡅  🡇     🗕  🗗  🗖
        public java.lang.String toString()
        Returns the name of this CIET, in string format.
        Overrides:
        toString in class java.lang.Enum<CIET>
        Returns:
        Will return the name of this CIET as a String. The actual string returned is, in in all three cases, the restricted-java key-word that indicating whether this is a 'class' 'interface' or 'enum' (Enumerated-Type) by returning that exact String as a result when invoking this method.
        Code:
        Exact Method Body:
         return name;
        
      • get

        🡅     🗕  🗗  🗖
        public static CIET get​(java.lang.String name)
        Returns the enum constant of this type with the specified name. An invocation of '.trim().toLowerCase()' is performed, allowing white-space and oddly capitalized names for the String 'name' parameter.

        Note:
        Java's enumerated-type auto-generated method 'valueOf(String name)' may not be over-ridden. Unfortunately, the String provided to this method only permits / tolerates String's that are identical to the exact-spelling of the enum-constant itself.

        For instance: CIET.valueOf("CLASS") returns the 'CLASS' constant. However if the string 'class' were passed, an 'IllegalArgumentException' would be thrown. In order to avoid this, this method get(String name) is provided as an alternative, as it accepts case-insensitive input.
        Parameters:
        name - This is the CIET name, as a String.
        Returns:
        the CIET constant with the specified name
        Throws:
        java.lang.NullPointerException - if 'name' is null.
        java.lang.IllegalArgumentException - if, even after trim() and toLowerCase(), none of the CIET names-as-Strings equal the specified input parameter 'name'
        Code:
        Exact Method Body:
         switch (name.trim().toLowerCase())
         {
             case "class"        : return CLASS;
             case "interface"    : return INTERFACE;
             case "enum"         : return ENUM;
             case "@interface"   : return ANNOTATION;
             default             : throw new IllegalArgumentException(
                 "There was no CIET associated with the provided string: [" + name + "]."
             );
         }