採用DDD開發資訊釋出系統(二) Info實體類

brighthas發表於2012-07-10
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 class="indent">


[該貼被brighthas於2012-07-11 08:26修改過]

相關文章