GitHub user zmacomber opened a pull request:
https://github.com/apache/commons-lang/pull/358
ClassUtils.getBaseClasses(desiredBase, packageName)
Hello,
I have been using a method in my company's (avadasoftware.com) code base
that I created for getting a list of classes that implement an interface. These
classes reside in a particular package that I query. I use this method in my
code base in the following manner:
List<FooInterface> fooClasses =
ClassUtils.getBaseClasses(FooInterface.class, "com.avada.foo");
I would like to put this in Apache's ClassUtils to move this generic code
out of our code base and into what I believe is a more appropriate place. I'm
striving to replace util/generic code in our code base with 3rd party libs as I
believe it will be better tested/supported/enhanced/etc... in the OSS world.
I have written several tests that are passing to test exceptional behavior
and also normal path behavior.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zmacomber/commons-lang master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-lang/pull/358.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #358
----
commit 9158247b6baaee11f1c7259d549314d1e2b0bcb3
Author: Zack Macomber <zack.macomber@...>
Date: 2018-09-28T22:01:39Z
Added 'public static <T> List<T> getBaseClasses(final Class<T> desiredBase,
final String packageName)' which returns a list of base classes/interfaces that
match the supplied type underneath the supplied package
----
---