From 3d503662a238000fe50ad6aad6289be7c137657b Mon Sep 17 00:00:00 2001 From: Luke Hutchison Date: Mon, 16 Aug 2021 17:54:56 -0600 Subject: [PATCH] Add missing method (#549) --- .../java/io/github/classgraph/ScanResult.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/classgraph/ScanResult.java b/src/main/java/io/github/classgraph/ScanResult.java index 682f413b4..0f1440664 100644 --- a/src/main/java/io/github/classgraph/ScanResult.java +++ b/src/main/java/io/github/classgraph/ScanResult.java @@ -1063,8 +1063,8 @@ public ClassInfoList getAllInterfaces() { } /** - * Get all interfaces implemented by the named class or by one of its superclasses, if this is a standard class, - * or the superinterfaces extended by this interface, if this is an interface. + * Get all interfaces implemented by the named class or by one of its superclasses, if the named class is a + * standard class, or the superinterfaces extended by this interface, if it is an interface. * * @param className * The class name. @@ -1082,6 +1082,19 @@ public ClassInfoList getInterfaces(final String className) { return classInfo == null ? ClassInfoList.EMPTY_LIST : classInfo.getInterfaces(); } + /** + * Get all interfaces implemented by the class or by one of its superclasses, if the given class is a standard + * class, or the superinterfaces extended by this interface, if it is an interface. + * + * @param classRef + * The class. + * @return A list of interfaces implemented by the given class (or superinterfaces extended by the given + * interface), or the empty list if none. + */ + public ClassInfoList getInterfaces(final Class classRef) { + return getInterfaces(classRef.getName()); + } + /** * Get all classes that implement (or have superclasses that implement) the interface (or one of its * subinterfaces).