자바에 의해 wicket에 로그인 페이지를 쓰고 있으며 가능한 한 일반적인 글을 쓰고 싶다. 그래서 나는 C++에서 함수 포인터로 유명한 함수를 클래스에 전달할 필요가있다. 클래스는 다음과 같습니다함수 포인터 Java에서
인증합니다 내가 어떻게해야 그 기능이class LoginForm extends Form
{
public LoginForm(String id,TextField username,TextField password,WebResponse webResponse)
{
super(id);
}
@Override
public void onSubmit()
{
String password = Login.this.getPassword();
String userId = Login.this.getUserId();
String role = authenticate(userId, password);
if (role != null)
{
if (Login.this.getSave())
{
utilities.CreateCookie("Username", userId, false, 1209600, (WebResponse) getRequestCycle().getResponse());
utilities.CreateCookie("Password", password, false, 1209600, (WebResponse) getRequestCycle().getResponse());
}
User loggedInUser = new User(userId, role);
WiaSession session = (WiaSession) getSession();
session.setUser(loggedInUser);
if (!continueToOriginalDestination())
{
setResponsePage(UserHome.class);
}
}
else
{
wrongUserPass.setVisible(true);
}
}
}
?
가능한 복제본 [Java에서 함수 포인터에 가장 가까운 대체 코드는 무엇입니까?] (http://stackoverflow.com/questions/122407/whats-the-nearest-substitute-for-a-function-pointer-in- 자바) – Raedwald