📄 customercontroller.java
字号:
/**
* UserController is used to control user's login,logout,register.
*/
public class CustomerController{
private Customer customer;
/**
* Class constructor.
* When create this object, the user to manage will be set as param.
* @param user the user's object that this class will manage.
*/
public CustomerController(Customer customer){
this.customer=customer;
}
/**
* This method is used to login user.
* <p>
* Algorithm:
* <p>
* This method will get access to database (user table).
* Then it will query whether the table has the record related to current name and pass.
* If the query's resultset is not null, then the user login success.
* Otherwise, the user cann't login.
* If the user login success, this method will read his/her information in the database and set them to the user object this class control.
* And also, set the login attribute of the user object with true.
* <p>
* Internal data structures:
* <p>
* User user.
* @see User
*
* @param name the user's login name.
* @param pass the user's login password.
* @return If user login success, return true. Otherwise, return false.
*/
public boolean login(String name,String pass){
//body
return true;
}
/**
* This method is used to logout user.
* <p>
* Algorithm:
* <p>
* This method just need to set the user's login attribute with false.
* Then everything's ok.
* <p>
* Internal data structures:
* <p>
* User user.
* @see User
*
*/
public void logout(){
//body
}
/**
* This method is used to register user.
* <p>
* Algorithm:
* <p>
* This method just need to insert an record to the database(user table).
* All the information need for field in the user table contains in the param object.
* If the database update success return true. Otherwise, return false.
* <p>
* Internal data structures:
* <p>
* User user.
* @see User
* @param u a user object which contains all the information need for register.
* @return If the user register success, return true. Otherwise, return false.
*/
public boolean register(Customer customer){
//body
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -