Package io.github.classgraph
Class ClassRefTypeSignature
- java.lang.Object
-
- io.github.classgraph.HierarchicalTypeSignature
-
- io.github.classgraph.TypeSignature
-
- io.github.classgraph.ReferenceTypeSignature
-
- io.github.classgraph.ClassRefOrTypeVariableSignature
-
- io.github.classgraph.ClassRefTypeSignature
-
public class ClassRefTypeSignature extends ClassRefOrTypeVariableSignature
A class reference type signature (called "ClassTypeSignature" in the classfile documentation).
-
-
Field Summary
Fields Modifier and Type Field Description protected ScanResult
scanResult
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
boolean
equalsIgnoringTypeParams(TypeSignature other)
Compare base types, ignoring generic type parameters.java.lang.String
getBaseClassName()
Get the name of the base class.ClassInfo
getClassInfo()
protected java.lang.String
getClassName()
Get the fully qualified class name (used bygetClassInfo()
andloadClass()
.java.lang.String
getFullyQualifiedClassName()
Get the name of the class, formed from the base name and any suffixes (suffixes are for inner class nesting, and are separated by '$'), but without any type arguments.java.util.List<java.lang.String>
getSuffixes()
Get any suffixes of the class (typically nested inner class names).java.util.List<java.util.List<TypeArgument>>
getSuffixTypeArguments()
Get any type arguments for any suffixes of the class, one list per suffix.java.util.List<TypeArgument>
getTypeArguments()
Get any type arguments of the base class.int
hashCode()
java.lang.Class<?>
loadClass()
Load the referenced class, if not already loaded, returning aClass<?>
reference for the referenced class.java.lang.Class<?>
loadClass(boolean ignoreExceptions)
Load the referenced class, if not already loaded, returning aClass<?>
reference for the referenced class.java.lang.String
toString()
Return the class type as a string.
-
-
-
Field Detail
-
scanResult
protected transient ScanResult scanResult
-
-
Method Detail
-
getBaseClassName
public java.lang.String getBaseClassName()
Get the name of the base class.- Returns:
- The name of the base class.
-
getFullyQualifiedClassName
public java.lang.String getFullyQualifiedClassName()
Get the name of the class, formed from the base name and any suffixes (suffixes are for inner class nesting, and are separated by '$'), but without any type arguments. For example,"xyz.Cls<String>.InnerCls<Integer>"
is returned as"xyz.Cls$InnerCls"
. The intent of this method is that if you replace '.' with '/', and then add the suffix ".class", you end up with the path of the classfile relative to the package root.For comparison,
toString()
uses '.' to separate suffixes, and includes type parameters, whereas this method uses '$' to separate suffixes, and does not include type parameters.- Returns:
- The fully-qualified name of the class, including suffixes but without type arguments.
-
getTypeArguments
public java.util.List<TypeArgument> getTypeArguments()
Get any type arguments of the base class.- Returns:
- The type arguments for the base class.
-
getSuffixes
public java.util.List<java.lang.String> getSuffixes()
Get any suffixes of the class (typically nested inner class names).- Returns:
- The class suffixes (for inner classes).
-
getSuffixTypeArguments
public java.util.List<java.util.List<TypeArgument>> getSuffixTypeArguments()
Get any type arguments for any suffixes of the class, one list per suffix.- Returns:
- The type arguments for the inner classes, one list per suffix.
-
loadClass
public java.lang.Class<?> loadClass(boolean ignoreExceptions)
Load the referenced class, if not already loaded, returning aClass<?>
reference for the referenced class. (Called byAnnotationClassRef.loadClass()
.)- Parameters:
ignoreExceptions
- if true, ignore exceptions and instead return null if the class could not be loaded.- Returns:
- The
Class<?>
reference for the referenced class. - Throws:
java.lang.IllegalArgumentException
- if the class could not be loaded and ignoreExceptions was false.
-
loadClass
public java.lang.Class<?> loadClass()
Load the referenced class, if not already loaded, returning aClass<?>
reference for the referenced class. (Called byAnnotationClassRef.loadClass()
.)- Returns:
- The
Class<?>
reference for the referenced class. - Throws:
java.lang.IllegalArgumentException
- if the class could not be loaded.
-
getClassName
protected java.lang.String getClassName()
Get the fully qualified class name (used bygetClassInfo()
andloadClass()
.- Returns:
- The fully qualified name of the class.
-
getClassInfo
public ClassInfo getClassInfo()
- Returns:
- The
ClassInfo
object for the referenced class, or null if the referenced class was not encountered during scanning (i.e. if no ClassInfo object was created for the class during scanning). N.B. even if this method returns null,loadClass()
may be able to load the referenced class by name.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
equalsIgnoringTypeParams
public boolean equalsIgnoringTypeParams(TypeSignature other)
Description copied from class:TypeSignature
Compare base types, ignoring generic type parameters.- Specified by:
equalsIgnoringTypeParams
in classTypeSignature
- Parameters:
other
- the otherTypeSignature
to compare to.- Returns:
- True if the two
TypeSignature
objects are equal, ignoring type parameters.
-
toString
public java.lang.String toString()
Return the class type as a string.For comparison,
getFullyQualifiedClassName()
uses '$' to separate suffixes, and does not include type parameters, whereas this method uses '.' to separate suffixes, and does include type parameters.- Overrides:
toString
in classjava.lang.Object
-
-