重构int,long等

时间:2014-08-08 07:16:45

标签: java eclipse variables refactoring

有没有办法在eclipse中重构变量字段?

long interval;

public WebsiteConnectionPing(String url, long interval, String serviceName) {
    this.url = url;
    this.interval = interval;
    this.serviceName = serviceName;
}
//......

我想重构类型为long的间隔字符串是否可能?

String interval;

public WebsiteConnectionPing(String url, String interval, String serviceName) {
    this.url = url;
    this.interval = interval;
    this.serviceName = serviceName;
}
//....

1 个答案:

答案 0 :(得分:1)

我发现了这种方式:

  1. 更改参数类型" interval"在构造函数中从long到String
  2. Eclipse在代码中显示错误:this.interval = interval;
  3. 选择第一个快速修复>更改'间隔的类型'到String