【发布时间】:2012-03-23 16:16:15
【问题描述】:
我有一些 3rd 方 bean,它们的方法签名非常适合现有接口,但它没有实现接口。
现在我想做这样的事情,这是行不通的。有什么解决方法吗?
someBean.setSomeInterface(
new Interface() extends SomeBeanThatMatchesAlotOfMethodsOfTheInterface {
});
【问题讨论】:
-
适配器模式怎么样? en.wikipedia.org/wiki/Adapter_pattern
标签: java inheritance interface extends implements