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 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 Modifier and Type Field Description (package private) static MethodInfoListEMPTY_LISTAn unmodifiable emptyMethodInfoList.private static longserialVersionUIDserialVersionUID-
Fields inherited from class io.github.classgraph.PotentiallyUnmodifiableList
modifiable
-
-
Constructor Summary
Constructors Constructor Description MethodInfoList()Construct a new modifiable empty list ofMethodInfoobjects.MethodInfoList(int sizeHint)Construct a new modifiable empty list ofMethodInfoobjects, given a size hint.MethodInfoList(java.util.Collection<MethodInfo> methodInfoCollection)Construct a new modifiable emptyMethodInfoList, given an initial collection ofMethodInfoobjects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,MethodInfoList>asMap()Get thisMethodInfoListas a map from method name to aMethodInfoListof methods with that name.booleancontainsName(java.lang.String methodName)Check whether the list contains a method with the given name.static MethodInfoListemptyList()Return an unmodifiable emptyMethodInfoList.MethodInfoListfilter(MethodInfoList.MethodInfoFilter filter)Find the subset of theMethodInfoobjects in this list for which the given filter predicate is true.protected voidfindReferencedClassInfo(java.util.Map<java.lang.String,ClassInfo> classNameToClassInfo, java.util.Set<ClassInfo> refdClassInfo, LogNode log)GetClassInfoobjects for any classes referenced in the type descriptor or type signature.MethodInfoListget(java.lang.String methodName)Returns a list of all methods matching a given name.MethodInfogetSingleMethod(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 ofMethodInfoobjects.
-
MethodInfoList
public MethodInfoList(int sizeHint)
Construct a new modifiable empty list ofMethodInfoobjects, 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 ofMethodInfoobjects.- Parameters:
methodInfoCollection- the collection ofMethodInfoobjects.
-
-
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)
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
public java.util.Map<java.lang.String,MethodInfoList> 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
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 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
public MethodInfo getSingleMethod(java.lang.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:
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 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.
-
-