beanutils.as
来自「快速FLEX+J2EE开发工具。具体自动生成功能代码功能。」· AS 代码 · 共 49 行
AS
49 行
/*
* Copyright 2008 [CompanyName], Inc. All rights reserved.
* Website: http://www.pomer.org.cn/
*/
package cn.org.pomer.utils
{
import mx.collections.ArrayCollection;
import mx.utils.ObjectUtil;
public class BeanUtils
{
public function BeanUtils()
{
//TODO: implement function
}
public static function copyProperties(dest:Object, orig:Object):void{
if(orig is ArrayCollection){
return;
}
var classInfo:Object = ObjectUtil.getClassInfo(orig);
var properties:Array = classInfo.properties;
for (var j:int = 0; j < properties.length; j++)
{
var prop:* = properties[j];
if(dest.hasOwnProperty(prop.toString())){
if(orig[prop] is Date){
dest[prop] = orig[prop];
}else{
var type:String = orig[prop] == null ? "null" : typeof(orig[prop]);
if("object" == type){
copyProperties(dest[prop],orig[prop]);
}else{
try{
dest[prop] = orig[prop];
}catch(e:Error){
trace(e.message);
}
}
}
}
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?