文件
- Note.java
包
- com.hzj163.mysqlitedb.beans
类
- Note
序列化
采取JAVA序列化方式,主要用于后期的Intent传递
方案:实现java.io.Serializable接口即可
属性
- int id; 主键
- String info; 便签内容
- String st; 便签添加时间 【修改的时候不能修改时间】
- 全部需要getxx和setxx
构造
- 空构造
- 全参构造
方法 【无】
比较public boolean equals(Object o)
- 两个对象的ID相等,那么视为相等
该类的作用
- 把业务里面的数据封装成一个实体beans,每当我们在任何业务领域操作便签的时候都会使用Note对象
package com.hzj163.mysqlitedb.beans;
import java.io.Serializable;
/**
* 作者: 黄志江老师 on 2015/9/21.
* 网址: www.hzj163.com
* 网书: https://www.gitbook.com/@hzj163
* 邮箱: [email protected]
*/
public class Note implements Serializable {
int id;
String info;
String st;
public Note() {
}
//比较方法,如果两个对象的ID相等视为相等
@Override
public boolean equals(Object o) {
Note temp=(Note)o;
if (this.getId()== temp.getId() )
{
return true;
}
else
{
return false;
}
}
public Note(int id, String info, String st) {
this.id = id;
this.info = info;
this.st = st;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
public String getSt() {
return st;
}
public void setSt(String st) {
this.st = st;
}
}