Package Torello.JavaDoc
Enum CIET
- java.lang.Object
-
- java.lang.Enum<CIET>
-
- Torello.JavaDoc.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
AnEnumerated Type (enum)
for identifying whether a java source code file is aClass, Interface
orEnumerated 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.
Hi-Lited Source-Code:- View Here: Torello/JavaDoc/CIET.java
- Open New Browser-Tab: Torello/JavaDoc/CIET.java
File Size: 3,319 Bytes Line Count: 85 '\n' Characters Found
-
-
Enum Constant Summary
Enum Constants Enum Constant ANNOTATION
CLASS
ENUM
INTERFACE
RECORD
-
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()
-
-
-
Enum Constant Detail
-
CLASS
-
INTERFACE
-
ENUM
-
ANNOTATION
public static final CIET ANNOTATION
Identifies that the associated file represents a java'Annotation'
(@interface
)
-
RECORD
-
-
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 namejava.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 classjava.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 theString 'name'
parameter.
Note:
Java's enumerated-type auto-generated method'valueOf(String name)'
may not be over-ridden. Unfortunately, theString
provided to this method only permits / toleratesString'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 methodget(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 + "]." ); }
-
-