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 interfaceFilter anMethodInfoListusing a predicate mapping anMethodInfoobject to a boolean, producing anotherMethodInfoListfor all items in the list for which the predicate is true. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final MethodInfoListAn unmodifiable emptyMethodInfoList.private static final longserialVersionUIDFields inherited from class io.github.classgraph.PotentiallyUnmodifiableList
modifiableFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new modifiable empty list ofMethodInfoobjects.MethodInfoList(int sizeHint) Construct a new modifiable empty list ofMethodInfoobjects, given a size hint.MethodInfoList(Collection<MethodInfo> methodInfoCollection) Construct a new modifiable emptyMethodInfoList, given an initial collection ofMethodInfoobjects. -
Method Summary
Modifier and TypeMethodDescriptionasMap()Get thisMethodInfoListas a map from method name to aMethodInfoListof methods with that name.booleancontainsName(String methodName) Check whether the list contains a method with the given name.static MethodInfoListReturn an unmodifiable emptyMethodInfoList.Find the subset of theMethodInfoobjects in this list for which the given filter predicate is true.protected voidfindReferencedClassInfo(Map<String, ClassInfo> classNameToClassInfo, Set<ClassInfo> refdClassInfo, LogNode log) GetClassInfoobjects 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, hashCodeMethods inherited from class io.github.classgraph.PotentiallyUnmodifiableList
add, add, addAll, addAll, clear, iterator, listIterator, makeUnmodifiable, remove, remove, removeAll, retainAll, setMethods 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, trimToSizeMethods inherited from class java.util.AbstractCollection
containsAll, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods 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 ofMethodInfoobjects. -
MethodInfoList
public MethodInfoList(int sizeHint) Construct a new modifiable empty list ofMethodInfoobjects, given a size hint.- Parameters:
sizeHint- the size hint
-
MethodInfoList
Construct a new modifiable emptyMethodInfoList, given an initial collection ofMethodInfoobjects.- Parameters:
methodInfoCollection- the collection ofMethodInfoobjects.
-
-
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) GetClassInfoobjects 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 thisMethodInfoListas a map from method name to aMethodInfoListof methods with that name.- Returns:
- This
MethodInfoListas a map from method name to aMethodInfoListof 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 aMethodInfoListrather than a singleMethodInfo.)- Parameters:
methodName- The name of a method.- Returns:
- A
MethodInfoListofMethodInfoobjects 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 aMethodInfoListrather 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. ThrowsIllegalArgumentExceptionif there are two methods with the given name.- Parameters:
methodName- The name of a method.- Returns:
- The
MethodInfoobject 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 theMethodInfoobjects in this list for which the given filter predicate is true.- Parameters:
filter- TheMethodInfoList.MethodInfoFilterto apply.- Returns:
- The subset of the
MethodInfoobjects in this list for which the given filter predicate is true.
-