Class AnnotationInfo
- All Implemented Interfaces:
HasName, Comparable<AnnotationInfo>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Class<?> The class ref, once the class is loaded.protected ScanResultThe scan result. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanprotected voidfindReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, nonapi.io.github.classgraph.utils.LogNode log) GetClassInfoobjects for any classes referenced in the type descriptor or type signature.Return theClassInfoobject for the annotation class.protected StringGet the name of the annotation class, forgetClassInfo().Get the default parameter values.getName()Get the name.Get the parameter values.getParameterValues(boolean includeDefaultValues) Get the parameter values.inthashCode()booleanChecks if the annotation is inherited.Load theAnnotationclass corresponding to thisAnnotationInfoobject, by callinggetClassInfo().loadClass(), then create a new instance of the annotation, with the annotation parameter values obtained from thisAnnotationInfoobject, possibly overriding default annotation parameter values obtained from callinggetClassInfo()thenClassInfo.getAnnotationDefaultParameterValues().toString()Render to string.protected voidtoString(boolean useSimpleNames, StringBuilder buf) Render to string.Render to string, using only simple names for classes.
-
Field Details
-
scanResult
The scan result. -
classRef
The class ref, once the class is loaded.
-
-
Method Details
-
getName
-
isInherited
public boolean isInherited()Checks if the annotation is inherited.- Returns:
- true if this annotation is meta-annotated with
Inherited.
-
getDefaultParameterValues
Get the default parameter values.- Returns:
- the list of default parameter values for this annotation, or the empty list if none.
-
getParameterValues
Get the parameter values.- Parameters:
includeDefaultValues- if true, include default values for any annotation parameter value that is missing.- Returns:
- The parameter values of this annotation, including any default parameter values inherited from the annotation class definition (if requested), or the empty list if none.
-
getParameterValues
Get the parameter values.- Returns:
- The parameter values of this annotation, including any default parameter values inherited from the annotation class definition, or the empty list if none.
-
getClassName
Get the name of the annotation class, forgetClassInfo().- Returns:
- the class name
-
findReferencedClassInfo
protected void findReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, nonapi.io.github.classgraph.utils.LogNode log) GetClassInfoobjects for any classes referenced in the type descriptor or type signature.- Parameters:
classNameToClassInfo- the map from class name toClassInfo.refdClassInfo- the referenced class infolog- the log
-
getClassInfo
-
loadClassAndInstantiate
Load theAnnotationclass corresponding to thisAnnotationInfoobject, by callinggetClassInfo().loadClass(), then create a new instance of the annotation, with the annotation parameter values obtained from thisAnnotationInfoobject, possibly overriding default annotation parameter values obtained from callinggetClassInfo()thenClassInfo.getAnnotationDefaultParameterValues().Note that the returned
Annotationwill have some sort ofInvocationHandlerproxy type, such asio.github.classgraph.features.$Proxy4orcom.sun.proxy.$Proxy6. This is an unavoidable side effect of the fact that concreteAnnotationinstances cannot be instantiated directly. (ClassGraph uses the same approach that the JDK uses to instantiate annotations from a map.) However, proxy instances are handled specially when it comes to casting andinstanceof: you are able to cast the returned proxy instance to the annotation type, andinstanceofchecks against the annotation class will succeed.Of course another option you have for getting the concrete annotations, rather than instantiating the annotations on a
ClassInfoobject via this method, is to callClassInfo.loadClass(), and read the annotations directly from the returnedClassobject.- Returns:
- The new
Annotationinstance, as a dynamic proxy object that can be cast to the expected annotation type.
-
compareTo
- Specified by:
compareToin interfaceComparable<AnnotationInfo>
-
equals
-
hashCode
-
toString
Render to string.- Parameters:
useSimpleNames- if true, use just the simple name of each class.buf- the buf
-
toStringWithSimpleNames
Render to string, using only simple names for classes.- Returns:
- the string representation, using simple names for classes.
-
toString
-