[問題] interface的使用? @inject的使用?
public class WorkbenchPresenter implements WorkbenchViewImpl.Presenter {
@Inject
protected BrowserView.Presenter browserPresenter;
略
public void init(){
browserPresenter.init();
}
略
}
public interface BrowserView extends View<BrowserView.Presenter> {
public interface Presenter {
void init();
}
}
想請教一下,
宣告了一個interface但是卻沒有implement它,直接使用interface的methoed
,我的想法這樣應該是不行的吧,應該是要有一個implement interace的子類別在等號的
右邊吧,請問有什麼可能能讓這段程式成立呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.146.83.112
※ 編輯: b6byc 來自: 122.146.83.112 (08/10 17:00)
→
08/10 20:12, , 1F
08/10 20:12, 1F
→
08/10 20:13, , 2F
08/10 20:13, 2F
→
08/10 20:14, , 3F
08/10 20:14, 3F
我想應該是這樣沒錯,不過程式碼裡沒有new,我也很納悶.
※ 編輯: b6byc 來自: 119.77.212.164 (08/10 23:47)
→
08/10 23:53, , 4F
08/10 23:53, 4F
推
08/11 00:33, , 5F
08/11 00:33, 5F
http://download.oracle.com/javaee/6/api/javax/inject/package-summary.html
@Inject Identifies injectable constructors, methods, and fields.
所以在java ee 6裡,自己就會辨識到method(在原程式碼是有implement,但我不懂如何
連接上的),感覺上真是神奇...
※ 編輯: b6byc 來自: 122.146.83.112 (08/11 10:08)
推
08/11 10:05, , 6F
08/11 10:05, 6F
推
08/11 16:42, , 7F
08/11 16:42, 7F