【发布时间】:2011-01-07 04:56:10
【问题描述】:
我有一组定义 API 的具体类,我想从 API 的实际实现中提取这些类的接口(即:本质上是类型层次结构和公共方法)。
例如,如果 API 中的公共类之一是
public class Foo extends Bar {
/* some fields which I don't care about */
public void method() {
/* implementation here */
}
public void otherMethod() {
/* implementation goes here */
}
/* some non public methods which I don't care about */
}
我想分成一个接口和一个实现
即
public interface FooInterface extends BarInterface {
public void method();
public void otherMethod()
}
public class Foo implements FooInterface {
/* etc etc */
}
和
有没有一种工具可以让我以自动化的方式进行这种分离,还是我必须推出自己的程序才能完成这项工作?它需要是一个需要最少交互的工具。
【问题讨论】:
标签: java interface refactoring