Typically in java I use reflections.org whenever I need to scan for classes that implement an interface.
I see that there is the reflections library scala-reflect, but am a bit lost and am pretty sure(really just assuming) that reflections.org won’t work for scala.
Is there something similar to reflections.org for scala or a recommended approach?
Traits are compiled to interfaces. Probably sometimes a helper class is defined (pre Scala 2.12?), but the interface based inheritance hierarchy still holds. You should try if that “org.reflections” % “reflections” library works on Scala traits. I would guess it does.
I’m not sure why I was thinking that scala compiled to some sort of voodoo, but reflections.org worked fine.
Just make sure to understand Runtime Classes in Java vs. Runtime Types in Scala. Using a trait should be ok.
Thanks. That’ll definitely save me some headaches down the road.