采用DDD开发信息发布系统(二) Info实体类

12-07-10 brighthas
function Info(id){}

var info = Info.prototype;
var getter = info.__defineGetter__;
var setter = info.__defineSetter__;

// 被访问,更改状态,访问数+1
info.accessed= function(){
	this._state = new InfoState(this.state.accessNum+1);	
}

// 刷新,更新时间为最新时间
info.refresh = function(){
      this._updateTime  =  new Date();
}

info.getter('state',function(){
	return this._state;	
});
info.getter('createTime',function(){
	return this._createTime;	
});
info.getter('updateTime',function(){
	return this._updateTime;	
});
info.getter(content',function(){
	return this._content;	
});
info.getter('title',function(){
	return this._title;	
});
info.getter('type',function(){
	return this._type;	
});



info.setter(content',function(content){

});
info.setter('title',function(title){
		
});
info.setter('type',function(type){
		
});


<p>

[该贴被brighthas于2012-07-11 08:26修改过]

猜你喜欢