Package io.github.classgraph
Class TypeArgument
- java.lang.Object
-
- io.github.classgraph.ScanResultObject
-
- io.github.classgraph.HierarchicalTypeSignature
-
- io.github.classgraph.TypeArgument
-
public final class TypeArgument extends HierarchicalTypeSignature
A type argument.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TypeArgument.Wildcard
A type wildcard.
-
Field Summary
Fields Modifier and Type Field Description private ReferenceTypeSignature
typeSignature
Type signature (will be null if wildcard == ANY).private TypeArgument.Wildcard
wildcard
A wildcard type.-
Fields inherited from class io.github.classgraph.HierarchicalTypeSignature
typeAnnotationInfo
-
Fields inherited from class io.github.classgraph.ScanResultObject
classRef, scanResult
-
-
Constructor Summary
Constructors Modifier Constructor Description private
TypeArgument(TypeArgument.Wildcard wildcard, ReferenceTypeSignature typeSignature)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTypeAnnotation(java.util.List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo)
Add a type annotation.boolean
equals(java.lang.Object obj)
void
findReferencedClassNames(java.util.Set<java.lang.String> refdClassNames)
Get the names of any classes referenced in the type signature.protected ClassInfo
getClassInfo()
Get theClassInfo
object for the referenced class, or null if the referenced class was not encountered during scanning (i.e.protected java.lang.String
getClassName()
The name of the class (used byScanResultObject.getClassInfo()
to fetch theClassInfo
object for the class).ReferenceTypeSignature
getTypeSignature()
Get the type signature associated with the wildcard (or null, if the wildcard is ANY).TypeArgument.Wildcard
getWildcard()
Get the type wildcard, which is one of {NONE, ANY, EXTENDS, SUPER}.int
hashCode()
private static TypeArgument
parse(Parser parser, java.lang.String definingClassName)
Parse a type argument.(package private) static java.util.List<TypeArgument>
parseList(Parser parser, java.lang.String definingClassName)
Parse a list of type arguments.(package private) void
setScanResult(ScanResult scanResult)
Set ScanResult backreferences in info objects after scan has completed.protected void
toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, java.lang.StringBuilder buf)
Render type signature to string.-
Methods inherited from class io.github.classgraph.HierarchicalTypeSignature
addTypeAnnotation, getTypeAnnotationInfo, toString
-
Methods inherited from class io.github.classgraph.ScanResultObject
findReferencedClassInfo, findReferencedClassInfo, loadClass, loadClass, loadClass, loadClass, toString, toString, toStringWithSimpleNames
-
-
-
-
Field Detail
-
wildcard
private final TypeArgument.Wildcard wildcard
A wildcard type.
-
typeSignature
private final ReferenceTypeSignature typeSignature
Type signature (will be null if wildcard == ANY).
-
-
Constructor Detail
-
TypeArgument
private TypeArgument(TypeArgument.Wildcard wildcard, ReferenceTypeSignature typeSignature)
Constructor.- Parameters:
wildcard
- The wildcard typetypeSignature
- The type signature
-
-
Method Detail
-
getWildcard
public TypeArgument.Wildcard getWildcard()
Get the type wildcard, which is one of {NONE, ANY, EXTENDS, SUPER}.- Returns:
- The type wildcard.
-
getTypeSignature
public ReferenceTypeSignature getTypeSignature()
Get the type signature associated with the wildcard (or null, if the wildcard is ANY).- Returns:
- The type signature.
-
addTypeAnnotation
protected void addTypeAnnotation(java.util.List<Classfile.TypePathNode> typePath, AnnotationInfo annotationInfo)
Description copied from class:HierarchicalTypeSignature
Add a type annotation.- Specified by:
addTypeAnnotation
in classHierarchicalTypeSignature
- Parameters:
typePath
- the type pathannotationInfo
- the annotation
-
parse
private static TypeArgument parse(Parser parser, java.lang.String definingClassName) throws ParseException
Parse a type argument.- Parameters:
parser
- The parser.definingClassName
- The name of the defining class (for resolving type variables).- Returns:
- The parsed method type signature.
- Throws:
ParseException
- If method type signature could not be parsed.
-
parseList
static java.util.List<TypeArgument> parseList(Parser parser, java.lang.String definingClassName) throws ParseException
Parse a list of type arguments.- Parameters:
parser
- The parser.definingClassName
- The name of the defining class (for resolving type variables).- Returns:
- The list of type arguments.
- Throws:
ParseException
- If type signature could not be parsed.
-
getClassName
protected java.lang.String 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
protected ClassInfo 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.
-
setScanResult
void setScanResult(ScanResult scanResult)
Description copied from class:ScanResultObject
Set ScanResult backreferences in info objects after scan has completed.- Overrides:
setScanResult
in classHierarchicalTypeSignature
- Parameters:
scanResult
- the scan result
-
findReferencedClassNames
public void findReferencedClassNames(java.util.Set<java.lang.String> refdClassNames)
Get the names of any classes referenced in the type signature.- Parameters:
refdClassNames
- the referenced class names.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toStringInternal
protected void toStringInternal(boolean useSimpleNames, AnnotationInfoList annotationsToExclude, java.lang.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.
-
-