Package io.github.classgraph
Class TypeParameter
- java.lang.Object
-
- io.github.classgraph.ScanResultObject
-
- io.github.classgraph.HierarchicalTypeSignature
-
- io.github.classgraph.TypeParameter
-
public final class TypeParameter extends HierarchicalTypeSignature
A type parameter.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ReferenceTypeSignature
classBound
Class bound -- may be null.(package private) java.util.List<ReferenceTypeSignature>
interfaceBounds
Interface bounds -- may be empty.(package private) java.lang.String
name
The type parameter identifier.-
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 protected
TypeParameter(java.lang.String identifier, ReferenceTypeSignature classBound, java.util.List<ReferenceTypeSignature> interfaceBounds)
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)
protected void
findReferencedClassNames(java.util.Set<java.lang.String> refdClassNames)
Get the names of any classes referenced in the type signature.ReferenceTypeSignature
getClassBound()
Get the type parameter class bound.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).java.util.List<ReferenceTypeSignature>
getInterfaceBounds()
Get the type parameter interface bound(s).java.lang.String
getName()
Get the type parameter identifier.int
hashCode()
(package private) static java.util.List<TypeParameter>
parseList(Parser parser, java.lang.String definingClassName)
Parse a list of type parameters intoTypeParameter
objects.(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
-
name
final java.lang.String name
The type parameter identifier.
-
classBound
final ReferenceTypeSignature classBound
Class bound -- may be null.
-
interfaceBounds
final java.util.List<ReferenceTypeSignature> interfaceBounds
Interface bounds -- may be empty.
-
-
Constructor Detail
-
TypeParameter
protected TypeParameter(java.lang.String identifier, ReferenceTypeSignature classBound, java.util.List<ReferenceTypeSignature> interfaceBounds)
Constructor.- Parameters:
identifier
- The type parameter identifier.classBound
- The type parameter class bound.interfaceBounds
- The type parameter interface bound.
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the type parameter identifier.- Returns:
- The type parameter identifier.
-
getClassBound
public ReferenceTypeSignature getClassBound()
Get the type parameter class bound.- Returns:
- The type parameter class bound. May be null.
-
getInterfaceBounds
public java.util.List<ReferenceTypeSignature> getInterfaceBounds()
Get the type parameter interface bound(s).- Returns:
- Get the type parameter interface bound(s), which may be the empty list.
-
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
-
parseList
static java.util.List<TypeParameter> parseList(Parser parser, java.lang.String definingClassName) throws ParseException
Parse a list of type parameters intoTypeParameter
objects.- Parameters:
parser
- the parserdefiningClassName
- the defining class name- Returns:
- the list of
TypeParameter
objects. - Throws:
ParseException
- if parsing fails
-
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
protected 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.
-
-