Top Description Inners Fields Constructors Methods
io.github.classgraph

public Class MethodInfoList

extends InfoList<MethodInfo>
Class Inheritance
Imports
java.util.Collection, .HashMap, .Map, .Set, nonapi.io.github.classgraph.utils.LogNode

A list of MethodInfo objects.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
MethodInfoList.MethodInfoFilter

Filter an MethodInfoList using a predicate mapping an MethodInfo object to a boolean, producing another MethodInfoList for all items in the list for which the predicate is true.

Field Summary

Modifier and TypeField and Description
pack-priv static final MethodInfoList
EMPTY_LIST

An unmodifiable empty MethodInfoList.

private static final long

Constructor Summary

AccessConstructor and Description
public
MethodInfoList()

Construct a new modifiable empty list of MethodInfo objects.

public
MethodInfoList(final int
the size hint
sizeHint
)

Construct a new modifiable empty list of MethodInfo objects, given a size hint.

public
MethodInfoList(final Collection<MethodInfo>
the collection of MethodInfo objects.
methodInfoCollection
)

Construct a new modifiable empty MethodInfoList, given an initial collection of MethodInfo objects.

Method Summary

Modifier and TypeMethod and Description
public Map<String, MethodInfoList>

Returns:

This MethodInfoList as a map from method name to a MethodInfoList of methods with that name.
asMap
()

Get this MethodInfoList as a map from method name to a MethodInfoList of methods with that name.

public boolean

Returns:

true if the list contains a method with the given name.
containsName
(final String
The name of a class.
methodName
)

Check whether the list contains a method with the given name.

public static MethodInfoList

Returns:

the unmodifiable empty MethodInfoList.
emptyList
()

Return an unmodifiable empty MethodInfoList.

public MethodInfoList

Returns:

The subset of the MethodInfo objects in this list for which the given filter predicate is true.
filter
(final MethodInfoList.MethodInfoFilter
The MethodInfoFilter to apply.
filter
)

Find the subset of the MethodInfo objects in this list for which the given filter predicate is true.

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
)

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

public MethodInfoList

Returns:

A MethodInfoList of MethodInfo objects from this list that have the given name (there may be more than one method with a given name, due to overloading, so this returns a MethodInfoList rather than a single MethodInfo). Returns the empty list if no method had a matching name.
get
(final String
The name of a method.
methodName
)

Returns a list of all methods matching a given name.

public MethodInfo

Returns:

The MethodInfo object from the list with the given name, if there is exactly one method with the given name. Returns null if there were no methods with the given name.
getSingleMethod
(final String
The name of a method.
methodName
)

Returns a single method with the given name, or null if not found.

Inherited from io.github.classgraph.InfoList:
equalsgetAsStringsgetAsStringsWithSimpleNamesgetNameshashCode

Field Detail

EMPTY_LISTback to summary
pack-priv static final MethodInfoList EMPTY_LIST

An unmodifiable empty MethodInfoList.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides io.github.classgraph.InfoList.serialVersionUID.

serialVersionUID

Constructor Detail

MethodInfoListback to summary
public MethodInfoList()

Construct a new modifiable empty list of MethodInfo objects.

MethodInfoListback to summary
public MethodInfoList(final int sizeHint)

Construct a new modifiable empty list of MethodInfo objects, given a size hint.

Parameters
sizeHint:int

the size hint

MethodInfoListback to summary
public MethodInfoList(final Collection<MethodInfo> methodInfoCollection)

Construct a new modifiable empty MethodInfoList, given an initial collection of MethodInfo objects.

Parameters
methodInfoCollection:Collection<MethodInfo>

the collection of MethodInfo objects.

Method Detail

asMapback to summary
public Map<String, MethodInfoList> asMap()

Get this MethodInfoList as a map from method name to a MethodInfoList of methods with that name.

Returns:Map<String, MethodInfoList>

This MethodInfoList as a map from method name to a MethodInfoList of methods with that name.

containsNameback to summary
public boolean containsName(final String methodName)

Check whether the list contains a method with the given name.

Parameters
methodName:String

The name of a class.

Returns:boolean

true if the list contains a method with the given name.

emptyListback to summary
public static MethodInfoList emptyList()

Return an unmodifiable empty MethodInfoList.

Returns:MethodInfoList

the unmodifiable empty MethodInfoList.

filterback to summary
public MethodInfoList filter(final MethodInfoList.MethodInfoFilter filter)

Find the subset of the MethodInfo objects in this list for which the given filter predicate is true.

Parameters
filter:MethodInfoList.MethodInfoFilter

The MethodInfoFilter to apply.

Returns:MethodInfoList

The subset of the MethodInfo objects in this list for which the given filter predicate is true.

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

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

the log

getback to summary
public MethodInfoList get(final String methodName)

Returns a list of all methods matching a given name. (There may be more than one method with a given name, due to overloading, so this returns a MethodInfoList rather than a single MethodInfo.)

Parameters
methodName:String

The name of a method.

Returns:MethodInfoList

A MethodInfoList of MethodInfo objects from this list that have the given name (there may be more than one method with a given name, due to overloading, so this returns a MethodInfoList rather than a single MethodInfo). Returns the empty list if no method had a matching name.

getSingleMethodback to summary
public MethodInfo getSingleMethod(final String methodName)

Returns a single method with the given name, or null if not found. Throws IllegalArgumentException if there are two methods with the given name.

Parameters
methodName:String

The name of a method.

Returns:MethodInfo

The MethodInfo object from the list with the given name, if there is exactly one method with the given name. Returns null if there were no methods with the given name.

Exceptions
IllegalArgumentException:
if there are two or more methods with the given name.
io.github.classgraph back to summary

public Interface MethodInfoList.MethodInfoFilter

Annotations
@FunctionalInterface

Filter an MethodInfoList using a predicate mapping an MethodInfo object to a boolean, producing another MethodInfoList for all items in the list for which the predicate is true.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

Whether or not to allow the item through the filter. If true, the item is copied to the output list; if false, it is excluded.
accept
(MethodInfo
The MethodInfo item to filter.
methodInfo
)

Whether or not to allow an MethodInfo list item through the filter.

Method Detail

acceptback to summary
public boolean accept(MethodInfo methodInfo)

Whether or not to allow an MethodInfo list item through the filter.

Parameters
methodInfo:MethodInfo

The MethodInfo item to filter.

Returns:boolean

Whether or not to allow the item through the filter. If true, the item is copied to the output list; if false, it is excluded.