[Java] Annotation(内注)实例一则(二)

2014-11-24 09:22:11 · 作者: · 浏览: 5
long time;
public int price;
public boolean isPaid;
/** 测试用。 */
public byte testByte;
/** 测试用。 */
public short testShort;
public float cicle;
public double testDouble;

public String toString() {
StringBuffer strBuffer = new StringBuffer();
strBuffer.append("id[" + id + "]\n");
strBuffer.append("name[" + name + "]\n");
strBuffer.append("time[" + time + "]\n");
strBuffer.append("price[" + price + "]\n");
strBuffer.append("isPaid[" + isPaid + "]\n");
strBuffer.append("cicle[" + cicle + "]\n");
strBuffer.append("testByte[" + testByte + "]\n");
strBuffer.append("testShort[" + testShort + "]\n");
strBuffer.append("testDouble[" + testDouble + "]\n");
return strBuffer.toString();
}

public static GoodsBean newInstance() {
GoodsBean bean = new GoodsBean();
bean.id = 123456789l;
bean.name = "AutoSave";
bean.time = 12345234252342l;
bean.price = 1024;
bean.isPaid = true;
bean.cicle = 2.356f;
bean.testByte = 8;
bean.testShort = 128;
bean.testDouble = 9856.2145d;
return bean;
}
}