Package io.github.classgraph
Class MethodInfoList
java.lang.Object
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<MethodInfo>
,Collection<MethodInfo>
,List<MethodInfo>
,RandomAccess
,SequencedCollection<MethodInfo>
A list of
MethodInfo
objects.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Filter anMethodInfoList
using a predicate mapping anMethodInfo
object to a boolean, producing anotherMethodInfoList
for all items in the list for which the predicate is true. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final MethodInfoList
An unmodifiable emptyMethodInfoList
.private static final long
serialVersionUIDFields inherited from class io.github.classgraph.PotentiallyUnmodifiableList
modifiable
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new modifiable empty list ofMethodInfo
objects.MethodInfoList
(int sizeHint) Construct a new modifiable empty list ofMethodInfo
objects, given a size hint.MethodInfoList
(Collection<MethodInfo> methodInfoCollection) Construct a new modifiable emptyMethodInfoList
, given an initial collection ofMethodInfo
objects. -
Method Summary
Modifier and TypeMethodDescriptionasMap()
Get thisMethodInfoList
as a map from method name to aMethodInfoList
of methods with that name.boolean
containsName
(String methodName) Check whether the list contains a method with the given name.static MethodInfoList
Return an unmodifiable emptyMethodInfoList
.Find the subset of theMethodInfo
objects in this list for which the given filter predicate is true.protected void
findReferencedClassInfo
(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log) GetClassInfo
objects for any classes referenced in the type descriptor or type signature.Returns a list of all methods matching a given name.getSingleMethod
(String methodName) Returns a single method with the given name, or null if not found.Methods inherited from class io.github.classgraph.InfoList
equals, getAsStrings, getAsStringsWithSimpleNames, getNames, hashCode
Methods inherited from class io.github.classgraph.PotentiallyUnmodifiableList
add, add, addAll, addAll, clear, iterator, listIterator, makeUnmodifiable, remove, remove, removeAll, retainAll, set
Methods inherited from class java.util.ArrayList
addFirst, addLast, clone, contains, ensureCapacity, forEach, get, getFirst, getLast, indexOf, isEmpty, lastIndexOf, listIterator, removeFirst, removeIf, removeLast, removeRange, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll, reversed
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDserialVersionUID- See Also:
-
EMPTY_LIST
An unmodifiable emptyMethodInfoList
.
-
-
Constructor Details
-
MethodInfoList
public MethodInfoList()Construct a new modifiable empty list ofMethodInfo
objects. -
MethodInfoList
public MethodInfoList(int sizeHint) Construct a new modifiable empty list ofMethodInfo
objects, given a size hint.- Parameters:
sizeHint
- the size hint
-
MethodInfoList
Construct a new modifiable emptyMethodInfoList
, given an initial collection ofMethodInfo
objects.- Parameters:
methodInfoCollection
- the collection ofMethodInfo
objects.
-
-
Method Details
-
emptyList
Return an unmodifiable emptyMethodInfoList
.- Returns:
- the unmodifiable empty
MethodInfoList
.
-
findReferencedClassInfo
protected void findReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log) GetClassInfo
objects for any classes referenced in the type descriptor or type signature.- Parameters:
classNameToClassInfo
- the map from class name toClassInfo
.refdClassInfo
- the referenced class infolog
- the log
-
asMap
Get thisMethodInfoList
as a map from method name to aMethodInfoList
of methods with that name.- Returns:
- This
MethodInfoList
as a map from method name to aMethodInfoList
of methods with that name.
-
containsName
Check whether the list contains a method with the given name.- Parameters:
methodName
- The name of a class.- Returns:
- true if the list contains a method with the given name.
-
get
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 aMethodInfoList
rather than a singleMethodInfo
.)- Parameters:
methodName
- The name of a method.- Returns:
- A
MethodInfoList
ofMethodInfo
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 aMethodInfoList
rather than a singleMethodInfo
). Returns the empty list if no method had a matching name.
-
getSingleMethod
Returns a single method with the given name, or null if not found. ThrowsIllegalArgumentException
if there are two methods with the given name.- Parameters:
methodName
- The name of a method.- 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. - Throws:
IllegalArgumentException
- if there are two or more methods with the given name.
-
filter
Find the subset of theMethodInfo
objects in this list for which the given filter predicate is true.- Parameters:
filter
- TheMethodInfoList.MethodInfoFilter
to apply.- Returns:
- The subset of the
MethodInfo
objects in this list for which the given filter predicate is true.
-