码迷,mamicode.com
首页 > 其他好文 > 详细

程序员的量化交易之路(18)--Cointrader之Event实体(6)

时间:2015-06-03 23:34:17      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:hibernate   量化交易   cointrader   esper   

转载需注明:

事件,是Esper的重要概念。这里我们定义个事件类,它是Temporal实体的派生类。

仅仅是对Temporal简单的包装。其代码如下:


package org.cryptocoinpartners.schema;

import org.joda.time.Instant;

import javax.persistence.MappedSuperclass;


/**
 * Subclasses of Event may be posted to Context
 *
 * @author Tim Olson
 */
//是一个基类,在数据库中不创建表格。
@MappedSuperclass
public abstract class Event extends Temporal {


    /**
     * If the Event's time has not been set when it is being published, it will be set to the current time of the
     * publishing Context
     */
    public void publishedAt(Instant instant) {
        if( getTime() == null )
            setTime(instant);
    }


    /** Most events should use this constructor to provide the time of the original happening, not the time of
     *  object creation */
    protected Event(Instant time) {
        super(time);
    }


    protected Event() {}


}


程序员的量化交易之路(18)--Cointrader之Event实体(6)

标签:hibernate   量化交易   cointrader   esper   

原文地址:http://blog.csdn.net/minimicall/article/details/46352029

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!