Package io.github.classgraph
Class MethodInfoList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<T>
-
- io.github.classgraph.InfoList<MethodInfo>
-
- io.github.classgraph.MethodInfoList
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<MethodInfo>
,Collection<MethodInfo>
,List<MethodInfo>
,RandomAccess
public class MethodInfoList extends InfoList<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.
-
Constructor Summary
Constructors Constructor Description MethodInfoList()
Construct 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, T element)
boolean
add(T element)
boolean
addAll(int index, Collection<? extends T> c)
boolean
addAll(Collection<? extends T> c)
Map<String,MethodInfoList>
asMap()
Get thisMethodInfoList
as a map from method name to aMethodInfoList
of methods with that name.void
clear()
boolean
containsName(String methodName)
Check whether the list contains a method with the given name.static MethodInfoList
emptyList()
Return an unmodifiable emptyMethodInfoList
.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.MethodInfo
getSingleMethod(String methodName)
Returns a single method with the given name, or null if not found.Iterator<T>
iterator()
ListIterator<T>
listIterator()
T
remove(int index)
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
T
set(int index, T element)
-
Methods inherited from class io.github.classgraph.InfoList
equals, getAsStrings, getAsStringsWithSimpleNames, getNames, hashCode
-
Methods inherited from class java.util.ArrayList
clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, lastIndexOf, listIterator, removeIf, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Constructor Detail
-
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
public MethodInfoList(Collection<MethodInfo> methodInfoCollection)
Construct a new modifiable emptyMethodInfoList
, given an initial collection ofMethodInfo
objects.- Parameters:
methodInfoCollection
- the collection ofMethodInfo
objects.
-
-
Method Detail
-
emptyList
public static MethodInfoList emptyList()
Return an unmodifiable emptyMethodInfoList
.- Returns:
- the unmodifiable empty
MethodInfoList
.
-
asMap
public Map<String,MethodInfoList> 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
public boolean containsName(String methodName)
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
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, 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
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.
-
add
public boolean add(T element)
-
add
public void add(int index, T element)
-
remove
public boolean remove(Object o)
-
remove
public T remove(int index)
-
addAll
public boolean addAll(Collection<? extends T> c)
-
addAll
public boolean addAll(int index, Collection<? extends T> c)
-
removeAll
public boolean removeAll(Collection<?> c)
-
retainAll
public boolean retainAll(Collection<?> c)
-
clear
public void clear()
-
set
public T set(int index, T element)
-
iterator
public Iterator<T> iterator()
-
listIterator
public ListIterator<T> listIterator()
- Specified by:
listIterator
in interfaceList<T>
- Overrides:
listIterator
in classArrayList<T>
-
-