Enum Class ClassNameFormat

java.lang.Object
java.lang.Enum<ClassNameFormat>
org.apache.juneau.commons.reflect.ClassNameFormat
All Implemented Interfaces:
Serializable, Comparable<ClassNameFormat>, Constable

public enum ClassNameFormat extends Enum<ClassNameFormat>
Defines how class names should be formatted when rendered as strings.

Controls which parts of the fully qualified class name are included in the output.

Example:

// Given class: java.util.Map.Entry ClassNameFormat.FULL // "java.util.Map$Entry" or "java.util.Map.Entry" ClassNameFormat.SHORT // "Map$Entry" or "Map.Entry" ClassNameFormat.SIMPLE // "Entry"

See Also:
  • Enum Constant Details

    • FULL

      public static final ClassNameFormat FULL
      Full name including package and outer classes.
      Examples:
      • "java.lang.String"
      • "java.util.Map$Entry" or "java.util.Map.Entry" (depending on separator)
      • "com.example.Outer$Inner$Deep"

      This format includes the complete package path and all enclosing class names. The separator character between outer and inner classes is configurable.

    • SHORT

      public static final ClassNameFormat SHORT
      Short name including outer classes but not the package.
      Examples:
      • "String"
      • "Map$Entry" or "Map.Entry" (depending on separator)
      • "Outer$Inner$Deep"

      This format includes enclosing class names but omits the package. Useful when the package context is already known or not needed. The separator character between outer and inner classes is configurable.

    • SIMPLE

      public static final ClassNameFormat SIMPLE
      Simple name without package or outer classes.
      Examples:
      • "String"
      • "Entry"
      • "Deep"

      This format returns only the innermost class name, omitting both the package and any enclosing class names. This is equivalent to Class.getSimpleName().

  • Method Details

    • values

      public static ClassNameFormat[] 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

      public static ClassNameFormat valueOf(String name)
      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 name
      NullPointerException - if the argument is null