Class TypeVariableSignature
- java.lang.Object
-
- io.github.lukehutch.fastclasspathscanner.typesignature.HierarchicalTypeSignature
-
- io.github.lukehutch.fastclasspathscanner.typesignature.TypeSignature
-
- io.github.lukehutch.fastclasspathscanner.typesignature.ReferenceTypeSignature
-
- io.github.lukehutch.fastclasspathscanner.typesignature.ClassRefOrTypeVariableSignature
-
- io.github.lukehutch.fastclasspathscanner.typesignature.TypeVariableSignature
-
public class TypeVariableSignature extends ClassRefOrTypeVariableSignature
A type variable signature.
-
-
Constructor Summary
Constructors Constructor Description TypeVariableSignature(String typeVariableName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)booleanequalsIgnoringTypeParams(TypeSignature other)Compare base types, ignoring generic type parameters.voidgetAllReferencedClassNames(Set<String> classNameListOut)Get the names of all classes referenced in the type signatureTypeParametergetCorrespondingTypeParameter()Look up a type variable (e.g.StringgetTypeVariableName()Get the name of the type variable.inthashCode()Class<?>instantiate(ScanResult scanResult)Instantiate the type signature into a class reference.StringtoString()StringtoStringWithTypeBound()Returns the type variable along with its type bound, if available (e.g.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from class io.github.lukehutch.fastclasspathscanner.typesignature.TypeSignature
parse
-
-
-
-
Constructor Detail
-
TypeVariableSignature
public TypeVariableSignature(String typeVariableName)
- Parameters:
typeVariableName- The type variable name.
-
-
Method Detail
-
getTypeVariableName
public String getTypeVariableName()
Get the name of the type variable.- Returns:
- The type variable name.
-
getCorrespondingTypeParameter
public TypeParameter getCorrespondingTypeParameter()
Look up a type variable (e.g. "T") in the defining method and/or enclosing class' type parameters, and returns the type parameter with the same name (e.g. "T extends com.xyz.Cls").- Returns:
- the type parameter (e.g. "T extends com.xyz.Cls", or simply "T" if the type parameter does not have any bounds). Returns null if a type parameter with the same name as the type variable could not be found (this should not in general happen, since type variables in successfully-compiled code should be able to be linked to the corresponding type parameter).
-
getAllReferencedClassNames
public void getAllReferencedClassNames(Set<String> classNameListOut)
Description copied from class:HierarchicalTypeSignatureGet the names of all classes referenced in the type signature- Specified by:
getAllReferencedClassNamesin classHierarchicalTypeSignature- Parameters:
classNameListOut- The set to store class names in.
-
instantiate
public Class<?> instantiate(ScanResult scanResult)
Description copied from class:TypeSignatureInstantiate the type signature into a class reference. The ScanResult is used to ensure the correct classloader is used to load the class.- Specified by:
instantiatein classTypeSignature- Parameters:
scanResult- The scan result.- Returns:
- The instantiation of the type signature as a
Class<?>.
-
equalsIgnoringTypeParams
public boolean equalsIgnoringTypeParams(TypeSignature other)
Description copied from class:TypeSignatureCompare base types, ignoring generic type parameters.- Specified by:
equalsIgnoringTypeParamsin classTypeSignature- Parameters:
other- the otherTypeSignatureto compare to.- Returns:
- True if the two
TypeSignatureobjects are equal, ignoring type parameters.
-
toStringWithTypeBound
public String toStringWithTypeBound()
Returns the type variable along with its type bound, if available (e.g. "X extends xyz.Cls"). You can get this in structured from by callinggetCorrespondingTypeParameter(). Returns just the type variable if there is no type bound, or if no type bound is known (i.e. if getCorrespondingTypeParameter() returns null).- Returns:
- The string representation.
-
-