Enum Class ClassArrayFormat
- All Implemented Interfaces:
Serializable,Comparable<ClassArrayFormat>,Constable
Controls the notation used to represent array dimensions in class names.
Example:
See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic ClassArrayFormatReturns the enum constant of this class with the specified name.static ClassArrayFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
JVM
JVM bytecode notation - prefix with[ for each dimension.Examples:
"[Ljava.lang.String;" -String[] "[[Ljava.lang.String;" -String[][] "[I" -int[] "[[I" -int[][] "[Z" -boolean[]
This is the format returned by
Class.getName()for array types. It uses JVM internal type descriptors where object arrays are prefixed with[L and suffixed with; , and primitive arrays use single-letter codes (I ,Z ,B ,C ,D ,F ,J ,S ).This format is primarily used for reflection and JVM internals.
-
BRACKETS
Source code notation - suffix with[] for each dimension.Examples:
"String[]" -String[] "String[][]" -String[][] "int[]" -int[] "int[][]" -int[][] "boolean[]" -boolean[]
This is the format used in Java source code and is the most human-readable. It's returned by
Class.getSimpleName()andClass.getCanonicalName()for array types.This is the most common format for documentation and display purposes.
-
WORD
Word notation - suffix with"Array" for each dimension.Examples:
"StringArray" -String[] "StringArrayArray" -String[][] "intArray" -int[] "intArrayArray" -int[][] "booleanArray" -boolean[]
This format is useful for generating variable names, method names, or other identifiers where special characters like
[] are not allowed.This format is particularly useful in code generation scenarios where you need valid Java identifiers.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-