Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在osgi中动态地将接口名称传递给实现类?
我需要一些在逻辑上意味着这样的东西:
// where the interface name is provided at runtime in Component.xml of declarative sevices in osgi public class Foo implements <T> { // do something }
并且无论我传递什么接口名称,它都应该实现该接口(因为该类实现了我传递的接口的所有方法)
你可以用 CGLIB 做各种疯狂的事情,但大多数时候你应该重新考虑你做事的方式,你可能会找到一个更简单的解决方案。