Package io.github.classgraph
Class BaseTypeSignature
java.lang.Object
io.github.classgraph.ScanResultObject
io.github.classgraph.HierarchicalTypeSignature
io.github.classgraph.TypeSignature
io.github.classgraph.BaseTypeSignature
A type signature for a base type (byte, char, double, float, int, long, short, boolean, or void).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final char
The type signature character used to represent the base type.Fields inherited from class io.github.classgraph.HierarchicalTypeSignature
typeAnnotationInfo
Fields inherited from class io.github.classgraph.ScanResultObject
classRef, scanResult
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addTypeAnnotation
(List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo) Add a type annotation to this type.boolean
boolean
Compare base types, ignoring generic type parameters.protected void
findReferencedClassNames
(Set<String> refdClassNames) Get the names of any classes referenced in the type signature.protected ClassInfo
Get theClassInfo
object for the referenced class, or null if the referenced class was not encountered during scanning (i.e.protected String
The name of the class (used byScanResultObject.getClassInfo()
to fetch theClassInfo
object for the class).Class
<?> getType()
Get the type.(package private) static Class
<?> getType
(char typeChar) Get the type for a type character.(package private) static char
getTypeChar
(String typeStr) Get the name of the type as a string.char
Get the type signature char used to represent the type, e.g.Get the name of the type as a string.(package private) static String
getTypeStr
(char typeChar) Get the name of the type as a string.int
hashCode()
(package private) Class
<?> Load the class named returned byScanResultObject.getClassInfo()
, or if that returns null, the class named byScanResultObject.getClassName()
.(package private) <T> Class
<T> Load the class named returned byScanResultObject.getClassInfo()
, or if that returns null, the class named byScanResultObject.getClassName()
.(package private) static BaseTypeSignature
Parse a base type.(package private) void
setScanResult
(ScanResult scanResult) Set ScanResult backreferences in info objects after scan has completed.protected void
toStringInternal
(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, StringBuilder buf) Render type signature to string.Methods inherited from class io.github.classgraph.TypeSignature
findReferencedClassInfo, getTypeAnnotationInfo, parse, parse
Methods inherited from class io.github.classgraph.HierarchicalTypeSignature
addTypeAnnotation, toString
Methods inherited from class io.github.classgraph.ScanResultObject
findReferencedClassInfo, loadClass, loadClass, toString, toString, toStringWithSimpleNames
-
Field Details
-
typeSignatureChar
private final char typeSignatureCharThe type signature character used to represent the base type.
-
-
Constructor Details
-
BaseTypeSignature
BaseTypeSignature(char typeSignatureChar) Constructor.
-
-
Method Details
-
getTypeStr
Get the name of the type as a string.- Parameters:
typeChar
- the type character, e.g. 'I'.- Returns:
- The name of the type, e.g. "int", or null if there was no match.
-
getTypeChar
Get the name of the type as a string.- Parameters:
typeStr
- the type character, e.g. "int".- Returns:
- The type, character, e.g. 'I', or '\0' if there was no match.
-
getType
Get the type for a type character.- Parameters:
typeChar
- the type character, e.g. 'I'.- Returns:
- The type class, e.g. int.class, or null if there was no match.
-
getTypeSignatureChar
public char getTypeSignatureChar()Get the type signature char used to represent the type, e.g. 'I' for int.- Returns:
- the type signature char, as a one-char String.
-
getTypeStr
Get the name of the type as a string.- Returns:
- The name of the type, such as "int", "float", or "void".
-
getType
Get the type.- Returns:
- The class of the base type, such as int.class, float.class, or void.class.
-
addTypeAnnotation
protected void addTypeAnnotation(List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo) Description copied from class:TypeSignature
Add a type annotation to this type.- Specified by:
addTypeAnnotation
in classTypeSignature
- Parameters:
typePath
- The type path.annotationInfo
- The annotation to add.
-
loadClass
Class<?> loadClass()Description copied from class:ScanResultObject
Load the class named returned byScanResultObject.getClassInfo()
, or if that returns null, the class named byScanResultObject.getClassName()
. Returns aClass<?>
reference for the class.- Overrides:
loadClass
in classScanResultObject
- Returns:
- The
Class<?>
reference for the referenced class.
-
loadClass
Description copied from class:ScanResultObject
Load the class named returned byScanResultObject.getClassInfo()
, or if that returns null, the class named byScanResultObject.getClassName()
. Returns aClass<?>
reference for the class, cast to the requested superclass or interface type.- Overrides:
loadClass
in classScanResultObject
- Type Parameters:
T
- the superclass or interface type- Parameters:
superclassOrInterfaceType
- The type to cast the resulting class reference to.- Returns:
- The
Class<?>
reference for the referenced class, or null if the class could not be loaded (or casting failed) and ignoreExceptions is true.
-
parse
Parse a base type.- Parameters:
parser
- the parser- Returns:
- the base type signature
-
getClassName
Description copied from class:ScanResultObject
The name of the class (used byScanResultObject.getClassInfo()
to fetch theClassInfo
object for the class).- Specified by:
getClassName
in classScanResultObject
- Returns:
- The class name.
-
getClassInfo
Description copied from class:ScanResultObject
Get theClassInfo
object for the referenced class, or null if the referenced class was not encountered during scanning (i.e. no ClassInfo object was created for the class during scanning). N.B. even if this method returns null,ScanResultObject.loadClass()
may be able to load the referenced class by name.- Overrides:
getClassInfo
in classScanResultObject
- Returns:
- The
ClassInfo
object for the referenced class.
-
findReferencedClassNames
Get the names of any classes referenced in the type signature.- Overrides:
findReferencedClassNames
in classTypeSignature
- Parameters:
refdClassNames
- the referenced class names.
-
setScanResult
Description copied from class:ScanResultObject
Set ScanResult backreferences in info objects after scan has completed.- Overrides:
setScanResult
in classHierarchicalTypeSignature
- Parameters:
scanResult
- the scan result
-
hashCode
public int hashCode() -
equals
-
equalsIgnoringTypeParams
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.
-
toStringInternal
protected void toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, StringBuilder buf) Description copied from class:HierarchicalTypeSignature
Render type signature to string.- Specified by:
toStringInternal
in classHierarchicalTypeSignature
- Parameters:
useSimpleNames
- whether to use simple names for classes.annotationsToExclude
- toplevel annotations to exclude, to eliminate duplication (toplevel annotations are both class/field/method annotations and type annotations).buf
- theStringBuilder
to write to.
-