Package io.github.classgraph
Class MethodInfoList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<T>
-
- io.github.classgraph.MethodInfoList
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<MethodInfo>,Collection<MethodInfo>,List<MethodInfo>,RandomAccess
public class MethodInfoList extends ArrayList<T>
A list ofMethodInfoobjects.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceMethodInfoList.MethodInfoFilterFilter anMethodInfoListusing a predicate mapping anMethodInfoobject to a boolean, producing anotherMethodInfoListfor all items in the list for which the predicate is true.
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,MethodInfoList>asMap()booleancontainsName(String methodName)MethodInfoListfilter(MethodInfoList.MethodInfoFilter filter)Find the subset of theMethodInfoobjects in this list for which the given filter predicate is true.MethodInfoListget(String methodName)Returns a list of all methods matching a given name.List<String>getAsStrings()List<String>getNames()MethodInfogetSingleMethod(String methodName)Returns a single method with the given name, or null if not found.-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, 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
-
-
-
-
Method Detail
-
asMap
public Map<String,MethodInfoList> asMap()
- Returns:
- This
MethodInfoListas a map from method name to aMethodInfoListof methods with that name.
-
containsName
public boolean containsName(String methodName)
- Parameters:
methodName- The name of a class.- Returns:
- true if the list contains a method with the given name.
-
get
public MethodInfoList get(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.)- Parameters:
methodName- The name of a method.- Returns:
- A list of
MethodInfoobjects in the list with the given name (there may be more than one method with a given name, due to overloading). Returns the empty list if no method had a matching name.
-
getSingleMethod
public MethodInfo getSingleMethod(String methodName)
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
public MethodInfoList filter(MethodInfoList.MethodInfoFilter 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.
-
getNames
public List<String> getNames()
- Returns:
- The names of all packages in this list, by calling
PackageInfo.getName()for each item in the list.
-
-