程序员的量化交易之路(17)--Cointrader之Temporal实体(5)
来源:互联网 发布:java之父宣布java 编辑:程序博客网 时间:2024/04/28 13:46
转载需要注明:http://blog.csdn.net/minimicall,http://cloudtrader.top/
这一小节说明一个时间实体Temporal实体,它的代码很简单。
package org.cryptocoinpartners.schema;import java.util.Date;import javax.persistence.Basic;import javax.persistence.MappedSuperclass;import javax.persistence.Transient;import org.hibernate.annotations.Type;import org.joda.time.Instant;/** * @author Tim Olson */
//这个标注说明这个类也是一个基类,不会在数据库中创建表@MappedSuperclasspublic class Temporal extends EntityBase { public Temporal(Instant time) { super(); this.time = time; this.dateTime = time.toDate(); this.timestamp = time.getMillis(); } /** For Events, this is the time the Event itself occured, not the time we received the Event. It should be remote * server time if available, and local time if the object was created locally */
/@/Type注解用于说明类型 @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentInstantAsMillisLong") @Basic(optional = false) public Instant getTime() { return time; }//这个注解用于说明该字段不会存储到数据库中 @Transient public Date getDateTime() { return dateTime; } @Transient public long getTimestamp() { return timestamp; } // JPA protected Temporal() { } protected void setTime(Instant time) { this.time = time; this.dateTime = time.toDate(); this.timestamp = time.getMillis(); } protected Instant time;//时间 private long timestamp;//时间截 private Date dateTime;//日期}
需要说明的是,这个类
0 0
- 程序员的量化交易之路(17)--Cointrader之Temporal实体(5)
- 程序员的量化交易之路(18)--Cointrader之Event实体(6)
- 程序员的量化交易之路(19)--Cointrader之Bar实体(7)
- 程序员的量化交易之路(20)--Cointrader之Assert实体(8)
- 程序员的量化交易之路(21)--Cointrader之Currency货币实体(9)
- 程序员的量化交易之路(24)--Cointrader之RemoteEvent远程事件实体(11)
- 程序员的量化交易之路(25)--Cointrader之MarketData市场数据实体(12)
- 程序员的量化交易之路(26)--Cointrader之Listing挂牌实体(13)
- 程序员的量化交易之路(28)--Cointrader之Offer报价实体(15)
- 程序员的量化交易之路(29)--Cointrader之Tick实体(16)
- 程序员的量化交易之路(30)--Cointrader之ConfigUtil(17)
- 程序员的量化交易之路(15)--Cointrader之EntityBase类(3)
- 程序员的量化交易之路(27)--Cointrader之PriceData价格数据(14)
- 程序员的量化交易之路(31)--cointrader之Balance现金(18)
- 程序员的量化交易之路(13)--Cointrader类图(1)
- 程序员的量化交易之路(14)--Cointrader数据表(2)
- 程序员的量化交易之路(22)--Cointrader值货币集合Currencies(10)
- 程序员的量化交易之路(1)----规划开篇
- is not in the sudoers file 解决
- WARNING: The host '$hostname' could not be looked up with resolveip.
- Sereja and Array
- Unity3d_用PlayerPrefs保存和读取数组
- XTU 1173 Five Tiger(简单模拟)
- 程序员的量化交易之路(17)--Cointrader之Temporal实体(5)
- 期末考试有感
- android开源项目---View篇
- UNIX网路编程(第三版) 关于源代码的使用问题
- poj 2505 A multiplication game(博弈)
- disruptor实操作手册(一)
- bootstrap 学习笔记 - 2 (排版+代码 样式)
- linux入门基础——linux用户基础
- 树莓派(raspberry)使用经验————设置有线和无线ip