Package io.github.classgraph
Class MethodInfoList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<MethodInfo>
-
- io.github.classgraph.MethodInfoList
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<MethodInfo>
,Collection<MethodInfo>
,List<MethodInfo>
,RandomAccess
public class MethodInfoList extends ArrayList<MethodInfo>
A list ofMethodInfo
objects.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MethodInfoList.MethodInfoFilter
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
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsName(String methodName)
MethodInfoList
filter(MethodInfoList.MethodInfoFilter filter)
Find the subset of theMethodInfo
objects in this list for which the given filter predicate is true.MethodInfoList
get(String methodName)
Returns a list of all methods matching a given name.List<String>
getAsStrings()
List<String>
getNames()
MethodInfo
getSingleMethod(String methodName)
Returns a single method with the given name, or null if not found.-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.util.AbstractList
equals, hashCode
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from interface java.util.Collection
parallelStream, stream
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode
-
-
-
-
Method Detail
-
getNames
public List<String> getNames()
- Returns:
- The names of all methods in this list, by calling
MethodInfo.getName()
for each item in the list.
-
getAsStrings
public List<String> getAsStrings()
- Returns:
- The string representations of all methods in this list (with annotations, modifiers, params, etc.),
by calling
MethodInfo.toString()
for each item in the list.
-
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
MethodInfo
objects 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. 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
public MethodInfoList filter(MethodInfoList.MethodInfoFilter 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.
-
-