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.


    • Field Summary

      Fields 
      Modifier and Type Field
      Class<? extends TypeDeclaration<?>> jpType
    • 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
    • Enum Constant Detail

      • CLASS

        🡇    
        public static final CIET CLASS
        Identifies that the associated file represents a java 'class'
        Code:
        Exact Constant Declaration:
        CLASS("class", ClassOrInterfaceDeclaration.class)
        
      • INTERFACE

        🡅  🡇    
        public static final CIET INTERFACE
        Identifies that the associated file represents a java 'interface'
        Code:
        Exact Constant Declaration:
        INTERFACE("interface", ClassOrInterfaceDeclaration.class)
        
      • ENUM

        🡅  🡇    
        public static final CIET ENUM
        Identifies that the associated file represents a java 'enum' (Enumerated-Type)
        Code:
        Exact Constant Declaration:
        ENUM("enum", EnumDeclaration.class)
        
      • ANNOTATION

        🡅  🡇    
        public static final CIET ANNOTATION
        Identifies that the associated file represents a java 'Annotation' (@interface)
        Code:
        Exact Constant Declaration:
        ANNOTATION("@interface", AnnotationDeclaration.class)
        
      • RECORD

        🡅  🡇    
        public static final CIET RECORD
        Identifies that the associated file represents a (new, Java 14+) 'record'.
        Code:
        Exact Constant Declaration:
        RECORD("record", null)
        
    • Field Detail

      • jpType

        🡅  🡇    
        public final java.lang.Class<? extends com.github.javaparser.ast.body.TypeDeclaration<?>> jpType
        The java.lang.Class of the Java Parser Type that is associated with this CIET.
        Code:
        Exact Field Declaration Expression:
        public final Class<? extends TypeDeclaration<?>> jpType;
        
    • 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.

        IMPORTANT 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 Strings that are identical to the exact-spelling of the enum-constant itself. For instance: CIET.valueOf("CLASS") returns enumerated-constant CLASS. 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.
        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 + "]."
             );
         }