Package io.github.classgraph
Class MethodInfoList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<T>
-
- io.github.classgraph.PotentiallyUnmodifiableList<T>
-
- io.github.classgraph.InfoList<MethodInfo>
-
- io.github.classgraph.MethodInfoList
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<MethodInfo>
,java.util.Collection<MethodInfo>
,java.util.List<MethodInfo>
,java.util.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.
-
Field Summary
Fields Modifier and Type Field Description (package private) static MethodInfoList
EMPTY_LIST
An unmodifiable emptyMethodInfoList
.private static long
serialVersionUID
serialVersionUID-
Fields inherited from class io.github.classgraph.PotentiallyUnmodifiableList
modifiable
-
-
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(java.util.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 java.util.Map<java.lang.String,MethodInfoList>
asMap()
Get thisMethodInfoList
as a map from method name to aMethodInfoList
of methods with that name.boolean
containsName(java.lang.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.protected void
findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.Set<ClassInfo> refdClassInfo, LogNode log)
GetClassInfo
objects for any classes referenced in the type descriptor or type signature.MethodInfoList
get(java.lang.String methodName)
Returns a list of all methods matching a given name.MethodInfo
getSingleMethod(java.lang.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
clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, lastIndexOf, listIterator, removeIf, removeRange, replaceAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
serialVersionUID- See Also:
- Constant Field Values
-
EMPTY_LIST
static final MethodInfoList EMPTY_LIST
An unmodifiable emptyMethodInfoList
.
-
-
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(java.util.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
.
-
findReferencedClassInfo
protected void findReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.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
public java.util.Map<java.lang.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(java.lang.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(java.lang.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(java.lang.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:
java.lang.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.
-
-