Application Scenario Settings
Taking students ' information management system as an example, this paper demonstrates the change of students ' information. The bean classes that define students here are:
Student.java
public class Student {
Private String StudentID;
private String name;
private int weight;
private int height;
Private Date birthday;
Public String Getstudentid () {
return studentid;
}
public void Setstudentid (String studentid) {
This.studentid = StudentID;
}
Public String GetName () {
return name;
}
public void SetName (String name) {
THIS.name = name;
}
public int getweight () {
return weight;
}
public void setweight (int weight) {
This.weight = weight;
}
public int getheight () {
return height;
}
public void setheight (int height) {
This.height = height;
}
Public Date Getbirthday () {
return birthday;
}
public void Setbirthday (Date birthday) {
This.birthday = Birthday;
}
@Override
Public String toString () {
Return "Student [studentid=" + StudentID + ", name=" + Name
+ ", weight=" + weight + ", height=" + height + ", birthday="
+ Birthday + "]";
}
Public Student (String StudentID, string name, int weight, int height,
Date birthday) {
Super ();
This.studentid = StudentID;
THIS.name = name;
This.weight = weight;
This.height = height;
This.birthday = Birthday;
}
Public Student () {
}
}
and define the student's additions and deletions to check the interface as follows:
Istudentdao.java
Public interface Istudentdao {
void Insert (Student s);
void Update (Student s);
void Delete (String studentid);
}
The interface implementation file that manipulates MongoDB is as follows,
Istudentdaoimpl.java
public class Istudentdaoimpl implements istudentdao{
@Override
public void Insert (Student s) {
Temporarily not implemented
}
@Override
public void Update (Student s) {
Temporarily not implemented
}
@Override
public void Delete (String studentid) {
Temporarily not implemented
}
}
Java Manipulation mongodb_2 (scenario settings)