Class ClassMemberInfo
java.lang.Object
io.github.classgraph.ClassMemberInfo
- All Implemented Interfaces:
HasName
- Direct Known Subclasses:
FieldInfo,MethodInfo
-
Constructor Summary
ConstructorsConstructorDescriptionClassMemberInfo(String definingClassName, String memberName, int modifiers, String typeDescriptorStr, String typeSignatureStr, AnnotationInfoList annotationInfo) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionGet a list of annotations on this class member, along with any annotation parameter values, wrapped inAnnotationInfoobjects.getAnnotationInfo(Class<? extends Annotation> annotation) Get a the non-Repeatableannotation on this class member, or null if the class member does not have the annotation.getAnnotationInfo(String annotationName) Get a the named non-Repeatableannotation on this class member, or null if the class member does not have the named annotation.getAnnotationInfoRepeatable(Class<? extends Annotation> annotation) Get a theRepeatableannotation on this class member, or the empty list if the class member does not have the annotation.getAnnotationInfoRepeatable(String annotationName) Get a the namedRepeatableannotation on this class member, or the empty list if the class member does not have the named annotation.Get theClassInfoobject for the class that declares this class member.Get the name of the class that declares this member.intReturns the modifier bits for the class member.abstract StringGet the modifiers as a string, e.g.getName()Get the name of the class member.abstract HierarchicalTypeSignatureReturns the parsed type descriptor for the class member, which will not include type parameters.Returns the type descriptor string for the class member, which will not include type parameters.abstract HierarchicalTypeSignatureReturns the parsed type signature for the class member, possibly including type parameters.abstract HierarchicalTypeSignatureReturns the type signature for the class member, possibly including type parameters.Returns the type signature string for the class member, possibly including type parameters.Returns the type signature string for the class member, possibly including type parameters.booleanhasAnnotation(Class<? extends Annotation> annotation) Check if the class member has a given annotation.booleanhasAnnotation(String annotationName) Check if the class member has a given named annotation.booleanisFinal()Returns true if this class member is final.booleanReturns true if this class member is private.booleanReturns true if this class member is protected.booleanisPublic()Returns true if this class member is public.booleanisStatic()Returns true if this class member is static.booleanReturns true if this class member is synthetic.toString()Render to string.Render to string, using only simple names for classes.
-
Constructor Details
-
ClassMemberInfo
public ClassMemberInfo(String definingClassName, String memberName, int modifiers, String typeDescriptorStr, String typeSignatureStr, AnnotationInfoList annotationInfo) Constructor.- Parameters:
definingClassName- The class the member is defined within.memberName- The name of the class member.modifiers- The class member modifiers.typeDescriptorStr- The class member type descriptor.typeSignatureStr- The class member type signature.annotationInfo-AnnotationInfofor any annotations on the class member.
-
-
Method Details
-
getClassInfo
-
getClassName
Get the name of the class that declares this member.- Returns:
- The name of the declaring class.
- See Also:
-
getName
-
getModifiers
public int getModifiers()Returns the modifier bits for the class member.- Returns:
- The modifier bits for the class member.
-
getModifiersStr
Get the modifiers as a string, e.g. "public static final". For the modifier bits, call getModifiers().- Returns:
- The modifiers modifiers, as a string.
-
isPublic
public boolean isPublic()Returns true if this class member is public.- Returns:
- True if the class member is public.
-
isPrivate
public boolean isPrivate()Returns true if this class member is private.- Returns:
- True if the class member is private.
-
isProtected
public boolean isProtected()Returns true if this class member is protected.- Returns:
- True if the class member is protected.
-
isStatic
public boolean isStatic()Returns true if this class member is static.- Returns:
- True if the class member is static.
-
isFinal
public boolean isFinal()Returns true if this class member is final.- Returns:
- True if the class member is final.
-
isSynthetic
public boolean isSynthetic()Returns true if this class member is synthetic.- Returns:
- True if the class member is synthetic.
-
getTypeDescriptor
Returns the parsed type descriptor for the class member, which will not include type parameters. If you need generic type parameters, callgetTypeSignature()instead.- Returns:
- The parsed type descriptor string for the class member.
-
getTypeDescriptorStr
Returns the type descriptor string for the class member, which will not include type parameters. If you need generic type parameters, callgetTypeSignatureStr()instead.- Returns:
- The type descriptor string for the class member.
-
getTypeSignature
Returns the parsed type signature for the class member, possibly including type parameters. If this returns null, that no type signature information is available for this class member, callgetTypeDescriptor()instead.- Returns:
- The parsed type signature for the class member, or null if not available.
- Throws:
IllegalArgumentException- if the class member type signature cannot be parsed (this should only be thrown in the case of classfile corruption, or a compiler bug that causes an invalid type signature to be written to the classfile).
-
getTypeSignatureStr
Returns the type signature string for the class member, possibly including type parameters. If this returns null, indicating that no type signature information is available for this class member, callgetTypeDescriptorStr()instead.- Returns:
- The type signature string for the class member, or null if not available.
-
getTypeSignatureOrTypeDescriptor
Returns the type signature for the class member, possibly including type parameters. If the type signature is null, indicating that no type signature information is available for this class member, returns the type descriptor instead.- Returns:
- The parsed type signature for the class member, or if not available, the parsed type descriptor for the class member.
-
getTypeSignatureOrTypeDescriptorStr
Returns the type signature string for the class member, possibly including type parameters. If the type signature string is null, indicating that no type signature information is available for this class member, returns the type descriptor string instead.- Returns:
- The type signature string for the class member, or if not available, the type descriptor string for the class member.
-
getAnnotationInfo
Get a list of annotations on this class member, along with any annotation parameter values, wrapped inAnnotationInfoobjects.- Returns:
- A list of annotations on this class member, along with any annotation parameter values, wrapped in
AnnotationInfoobjects, or the empty list if none.
-
getAnnotationInfo
Get a the non-Repeatableannotation on this class member, or null if the class member does not have the annotation. (UsegetAnnotationInfoRepeatable(Class)forRepeatableannotations.)- Parameters:
annotation- The annotation.- Returns:
- An
AnnotationInfoobject representing the annotation on this class member, or null if the class member does not have the annotation.
-
getAnnotationInfo
Get a the named non-Repeatableannotation on this class member, or null if the class member does not have the named annotation. (UsegetAnnotationInfoRepeatable(String)forRepeatableannotations.)- Parameters:
annotationName- The annotation name.- Returns:
- An
AnnotationInfoobject representing the named annotation on this class member, or null if the class member does not have the named annotation.
-
getAnnotationInfoRepeatable
Get a theRepeatableannotation on this class member, or the empty list if the class member does not have the annotation.- Parameters:
annotation- The annotation.- Returns:
- An
AnnotationInfoListof all instances of the annotation on this class member, or the empty list if the class member does not have the annotation.
-
getAnnotationInfoRepeatable
Get a the namedRepeatableannotation on this class member, or the empty list if the class member does not have the named annotation.- Parameters:
annotationName- The annotation name.- Returns:
- An
AnnotationInfoListof all instances of the named annotation on this class member, or the empty list if the class member does not have the named annotation.
-
hasAnnotation
Check if the class member has a given annotation.- Parameters:
annotation- The annotation.- Returns:
- true if this class member has the annotation.
-
hasAnnotation
Check if the class member has a given named annotation.- Parameters:
annotationName- The name of an annotation.- Returns:
- true if this class member has the named annotation.
-
toStringWithSimpleNames
Render to string, using only simple names for classes.- Returns:
- the string representation, using simple names for classes.
-
toString
-