import mx.utils.ObjectUtil;
/**
* Author:luodongfu
* Data:2012
*/
public class BaseCopyObject
{
/**
* 拷贝source的值到targetObj对象中
* 包括:set get 函数以及其他属性,和其父类属性 set get函数
*/
public function copyObjectAll(source:Object):void
{
var info:Object = ObjectUtil.getClassInfo(source);
var props:Array = info["properties"];
for each(var qn:QName in props)
{
if(this.hasOwnProperty(qn.localName))
this[qn.localName] = source[qn.localName];
}
}
/**
* 拷贝source的值到targetObj对象中
* 包括:其他属性不包括本身以及父类set get对象属性
*/
public function copyObjectPropertis(source:Object):void
{
for (var property:String in source)
{
if (this.hasOwnProperty(propertyp))
this[property] = source[property];
}
}
}
}