Class AnnotationEnumValue

java.lang.Object
io.github.classgraph.AnnotationEnumValue
All Implemented Interfaces:
Comparable<AnnotationEnumValue>

public class AnnotationEnumValue extends Object implements Comparable<AnnotationEnumValue>
Class for wrapping an enum constant value (split into class name and constant name), as used as an annotation parameter value.
  • Field Details

    • scanResult

      protected transient ScanResult scanResult
      The scan result.
    • classRef

      protected transient Class<?> classRef
      The class ref, once the class is loaded.
  • Method Details

    • getClassName

      public String getClassName()
      Get the class name.
      Returns:
      The name of the enum class.
    • getValueName

      public String getValueName()
      Get the value name.
      Returns:
      The name of the enum const value.
    • getName

      public String getName()
      Get the name.
      Returns:
      The fully-qualified name of the enum constant value, i.e. (getClassName() + {#getValueName()}).
    • loadClassAndReturnEnumValue

      public Object loadClassAndReturnEnumValue(boolean ignoreExceptions) throws IllegalArgumentException
      Loads the enum class, instantiates the enum constants for the class, and returns the enum constant value represented by this AnnotationEnumValue.
      Parameters:
      ignoreExceptions - If true, ignore classloading exceptions and return null on failure.
      Returns:
      The enum constant value represented by this AnnotationEnumValue
      Throws:
      IllegalArgumentException - if the class could not be loaded and ignoreExceptions was false, or if the enum constant is invalid.
    • loadClassAndReturnEnumValue

      public Object loadClassAndReturnEnumValue() throws IllegalArgumentException
      Loads the enum class, instantiates the enum constants for the class, and returns the enum constant value represented by this AnnotationEnumValue.
      Returns:
      The enum constant value represented by this AnnotationEnumValue
      Throws:
      IllegalArgumentException - if the class could not be loaded, or the enum constant is invalid.
    • compareTo

      public int compareTo(AnnotationEnumValue o)
      Specified by:
      compareTo in interface Comparable<AnnotationEnumValue>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      protected void toString(boolean useSimpleNames, StringBuilder buf)
      Render to string.
      Parameters:
      useSimpleNames - if true, use just the simple name of each class.
      buf - the buf
    • findReferencedClassInfo

      protected void findReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, nonapi.io.github.classgraph.utils.LogNode log)
      Get ClassInfo objects for any classes referenced by this object.
      Parameters:
      classNameToClassInfo - the map from class name to ClassInfo.
      refdClassInfo - the referenced class info
      log - the log
    • toStringWithSimpleNames

      public String toStringWithSimpleNames()
      Render to string, using only simple names for classes.
      Returns:
      the string representation, using simple names for classes.
    • toString

      public String toString()
      Render to string.
      Overrides:
      toString in class Object
      Returns:
      the string representation.