Top Description Fields Constructors Methods
io.github.classgraph

public final Class MethodTypeSignature

extends HierarchicalTypeSignature
Class Inheritance
Imports
java.util.ArrayList, .Collections, .HashSet, .List, .Map, .Set, io.github.classgraph.Classfile.TypePathNode, nonapi.io.github.classgraph.types.ParseException, .Parser, nonapi.io.github.classgraph.utils.LogNode

A method type signature (called "MethodSignature" in the classfile documentation).

Field Summary

Modifier and TypeField and Description
private final List<TypeSignature>
parameterTypeSignatures

The method parameter type signatures.

private AnnotationInfoList
receiverTypeAnnotationInfo

Any type annotation(s) on an explicit receiver parameter.

private final TypeSignature
resultType

The method result type.

private final List<ClassRefOrTypeVariableSignature>
throwsSignatures

The throws type signatures.

pack-priv final List<TypeParameter>
typeParameters

The method type parameters.

Inherited from io.github.classgraph.HierarchicalTypeSignature:
typeAnnotationInfo

Constructor Summary

AccessConstructor and Description
private
MethodTypeSignature(final List<TypeParameter>
The type parameters for the method.
typeParameters
,
final List<TypeSignature>
The parameter types for the method.
paramTypes
,
final TypeSignature
The return type for the method.
resultType
,
final List<ClassRefOrTypeVariableSignature>
The throws signatures for the method.
throwsSignatures
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addRecieverTypeAnnotation(final AnnotationInfo
the receiver type annotation
annotationInfo
)

Add a type annotation for an explicit receiver parameter.

protected void
addTypeAnnotation(final List<Classfile.TypePathNode>
the type path
typePath
,
final AnnotationInfo
the annotation
annotationInfo
)

Implements abstract io.github.classgraph.HierarchicalTypeSignature.addTypeAnnotation.

Add a type annotation.

public boolean
equals(final Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

protected void
findReferencedClassInfo(final Map<String, ClassInfo>
the map from class name to ClassInfo.
classNameToClassInfo
,
final Set<ClassInfo>
the referenced class info
refdClassInfo
,
final LogNode
the log
log
)

Overrides io.github.classgraph.ScanResultObject.findReferencedClassInfo.

Get ClassInfo objects for any classes referenced in the type descriptor or type signature.

protected void
findReferencedClassNames(final Set<String>
the referenced class names.
refdClassNames
)

Get the names of any classes referenced in the type signature.

protected ClassInfo
getClassInfo()

Overrides io.github.classgraph.ScanResultObject.getClassInfo.

Get the ClassInfo 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).

protected String
getClassName()

Implements abstract io.github.classgraph.ScanResultObject.getClassName.

The name of the class (used by getClassInfo() to fetch the ClassInfo object for the class).

pack-priv List<TypeSignature>

Returns:

The parameter types for the method, as TypeSignature parsed type objects.
getParameterTypeSignatures
()

Get the type signatures of the method parameters.

public AnnotationInfoList

Returns:

type annotations on the explicit receiver parameter, or null if none.
getReceiverTypeAnnotationInfo
()

Get type annotations on the explicit receiver parameter, or null if none.

public TypeSignature

Returns:

The result type for the method, as a TypeSignature parsed type object.
getResultType
()

Get the result type for the method.

public List<ClassRefOrTypeVariableSignature>

Returns:

The throws types for the method, as TypeSignature parsed type objects.
getThrowsSignatures
()

Get the throws type(s) for the method.

public List<TypeParameter>

Returns:

The type parameters for the method, if any, otherwise null.
getTypeParameters
()

Get the type parameters for the method, if this is a generic method.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

pack-priv static MethodTypeSignature

Returns:

The parsed method type signature.
parse
(final String
The type descriptor of the method.
typeDescriptor
,
final String
The name of the defining class (for resolving type variables).
definingClassName
)

Parse a method signature.

pack-priv void
setScanResult(final ScanResult
the scan result
scanResult
)

Overrides io.github.classgraph.HierarchicalTypeSignature.setScanResult.

Set ScanResult backreferences in info objects after scan has completed.

protected void
toStringInternal(final boolean
whether to use simple names for classes.
useSimpleNames
,
final AnnotationInfoList
toplevel annotations to exclude, to eliminate duplication (toplevel annotations are both class/field/method annotations and type annotations).
annotationsToExclude
,
final StringBuilder
the StringBuilder to write to.
buf
)

Implements abstract io.github.classgraph.HierarchicalTypeSignature.toStringInternal.

Render type signature to string.

Inherited from io.github.classgraph.HierarchicalTypeSignature:
addTypeAnnotationgetTypeAnnotationInfotoString

Field Detail

parameterTypeSignaturesback to summary
private final List<TypeSignature> parameterTypeSignatures

The method parameter type signatures.

receiverTypeAnnotationInfoback to summary
private AnnotationInfoList receiverTypeAnnotationInfo

Any type annotation(s) on an explicit receiver parameter.

resultTypeback to summary
private final TypeSignature resultType

The method result type.

throwsSignaturesback to summary
private final List<ClassRefOrTypeVariableSignature> throwsSignatures

The throws type signatures.

typeParametersback to summary
pack-priv final List<TypeParameter> typeParameters

The method type parameters.

Constructor Detail

MethodTypeSignatureback to summary
private MethodTypeSignature(final List<TypeParameter> typeParameters, final List<TypeSignature> paramTypes, final TypeSignature resultType, final List<ClassRefOrTypeVariableSignature> throwsSignatures)

Constructor.

Parameters
typeParameters:List<TypeParameter>

The type parameters for the method.

paramTypes:List<TypeSignature>

The parameter types for the method.

resultType:TypeSignature

The return type for the method.

throwsSignatures:List<ClassRefOrTypeVariableSignature>

The throws signatures for the method.

Method Detail

addRecieverTypeAnnotationback to summary
pack-priv void addRecieverTypeAnnotation(final AnnotationInfo annotationInfo)

Add a type annotation for an explicit receiver parameter.

Parameters
annotationInfo:AnnotationInfo

the receiver type annotation

addTypeAnnotationback to summary
protected void addTypeAnnotation(final List<Classfile.TypePathNode> typePath, final AnnotationInfo annotationInfo)

Implements abstract io.github.classgraph.HierarchicalTypeSignature.addTypeAnnotation.

Doc from io.github.classgraph.HierarchicalTypeSignature.addTypeAnnotation.

Add a type annotation.

Parameters
typePath:List<Classfile.TypePathNode>

the type path

annotationInfo:AnnotationInfo

the annotation

Annotations
@Override
equalsback to summary
public boolean equals(final Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
findReferencedClassInfoback to summary
protected void findReferencedClassInfo(final Map<String, ClassInfo> classNameToClassInfo, final Set<ClassInfo> refdClassInfo, final LogNode log)

Overrides io.github.classgraph.ScanResultObject.findReferencedClassInfo.

Get ClassInfo objects for any classes referenced in the type descriptor or type signature.

Parameters
classNameToClassInfo:Map<String, ClassInfo>

the map from class name to ClassInfo.

refdClassInfo:Set<ClassInfo>

the referenced class info

log:LogNode

Doc from io.github.classgraph.ScanResultObject.findReferencedClassInfo.

the log

Annotations
@Override
findReferencedClassNamesback to summary
protected void findReferencedClassNames(final Set<String> refdClassNames)

Get the names of any classes referenced in the type signature.

Parameters
refdClassNames:Set<String>

the referenced class names.

getClassInfoback to summary
protected ClassInfo getClassInfo()

Overrides io.github.classgraph.ScanResultObject.getClassInfo.

Doc from io.github.classgraph.ScanResultObject.getClassInfo.

Get the ClassInfo 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, loadClass() may be able to load the referenced class by name.

Returns:ClassInfo

The ClassInfo object for the referenced class.

Annotations
@Override
getClassNameback to summary
protected String getClassName()

Implements abstract io.github.classgraph.ScanResultObject.getClassName.

Doc from io.github.classgraph.ScanResultObject.getClassName.

The name of the class (used by getClassInfo() to fetch the ClassInfo object for the class).

Returns:String

The class name.

Annotations
@Override
getParameterTypeSignaturesback to summary
pack-priv List<TypeSignature> getParameterTypeSignatures()

Get the type signatures of the method parameters. N.B. this is non-public, since the types have to be aligned with other parameter metadata. The type of a parameter can be obtained post-alignment from the parameter's MethodParameterInfo object.

Returns:List<TypeSignature>

The parameter types for the method, as TypeSignature parsed type objects.

getReceiverTypeAnnotationInfoback to summary
public AnnotationInfoList getReceiverTypeAnnotationInfo()

Get type annotations on the explicit receiver parameter, or null if none.

Returns:AnnotationInfoList

type annotations on the explicit receiver parameter, or null if none.

getResultTypeback to summary
public TypeSignature getResultType()

Get the result type for the method.

Returns:TypeSignature

The result type for the method, as a TypeSignature parsed type object.

getThrowsSignaturesback to summary
public List<ClassRefOrTypeVariableSignature> getThrowsSignatures()

Get the throws type(s) for the method.

Returns:List<ClassRefOrTypeVariableSignature>

The throws types for the method, as TypeSignature parsed type objects.

getTypeParametersback to summary
public List<TypeParameter> getTypeParameters()

Get the type parameters for the method, if this is a generic method.

Returns:List<TypeParameter>

The type parameters for the method, if any, otherwise null.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
parseback to summary
pack-priv static MethodTypeSignature parse(final String typeDescriptor, final String definingClassName) throws ParseException

Parse a method signature.

Parameters
typeDescriptor:String

The type descriptor of the method.

definingClassName:String

The name of the defining class (for resolving type variables).

Returns:MethodTypeSignature

The parsed method type signature.

Exceptions
ParseException:
If method type signature could not be parsed.
setScanResultback to summary
pack-priv void setScanResult(final ScanResult scanResult)

Overrides io.github.classgraph.HierarchicalTypeSignature.setScanResult.

Doc from io.github.classgraph.ScanResultObject.setScanResult.

Set ScanResult backreferences in info objects after scan has completed.

Parameters
scanResult:ScanResult

the scan result

Annotations
@Override
toStringInternalback to summary
protected void toStringInternal(final boolean useSimpleNames, final AnnotationInfoList annotationsToExclude, final StringBuilder buf)

Implements abstract io.github.classgraph.HierarchicalTypeSignature.toStringInternal.

Doc from io.github.classgraph.HierarchicalTypeSignature.toStringInternal.

Render type signature to string.

Parameters
useSimpleNames:boolean

whether to use simple names for classes.

annotationsToExclude:AnnotationInfoList

toplevel annotations to exclude, to eliminate duplication (toplevel annotations are both class/field/method annotations and type annotations).

buf:StringBuilder

the StringBuilder to write to.

Annotations
@Override