包 | mx.utils |
类 | public class RPCObjectUtil |
继承 | RPCObjectUtil Object |
方法 | 定义方 | ||
---|---|---|---|
[静态] 返回指定对象的关于该类以及该类的属性的信息。 | RPCObjectUtil | ||
指示对象是否已经定义了指定的属性。 | Object | ||
指示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | ||
指示指定的属性是否存在、是否可枚举。 | Object | ||
设置循环操作动态属性的可用性。 | Object | ||
[静态] 将指定的对象代码美化为一个字符串。 | RPCObjectUtil | ||
返回指定对象的原始值。 | Object |
getClassInfo | () | 方法 |
public static function getClassInfo(obj:Object, excludes:Array = null, options:Object = null):Object
返回指定对象的关于该类以及该类的属性的信息。
参数
obj:Object — 要检查的 Object。 | |
excludes:Array (default = null ) —
指定应从返回结果中排除的属性名称的字符串数组。例如,可以指定 Event 对象的 ["currentTarget", "target"] ,因为这些属性可导致返回结果变大。
| |
options:Object (default = null ) —
该对象包含一个或多个属性,控制由该方法返回的信息。这些属性包括:
|
Object —
对象包含下列属性:
|
toString | () | 方法 |
public static function toString(value:Object, namespaceURIs:Array = null, exclude:Array = null):String
将指定的对象代码美化为一个字符串。所有属性将按字母排序。打印过程中将为每个对象分配一个 ID;该值将在对象类型标记的旁边显示,前面带有“#”号,例如:
(mx.messaging.messages::AsyncMessage)#2.
此 ID 用于指示 circular 引用发生的时间。Class
类型的对象属性将仅显示为分配的类型。例如如下所示的自定义的定义:
public class MyCustomClass { public var clazz:Class; }
为 clazz
属性分配Date
的显示如下:
(somepackage::MyCustomClass)#0 clazz = (Date)
参数
value:Object — 要美化打印的对象。 | |
namespaceURIs:Array (default = null ) — 输出中要包括的属性的命名空间 URI 数组。默认情况下,输出中仅包括公共命名空间中的属性。要获取不考虑命名空间的所有属性,传递仅有单个元素 "*" 的数组。 | |
exclude:Array (default = null ) — 应从输出中排除的属性名称的数组。 使用它从格式化的字符串中删除数据。 |
String — 包含指定对象格式化版本的字符串。 |
// example 1 var obj:AsyncMessage = new AsyncMessage(); obj.body = []; obj.body.push(new AsyncMessage()); obj.headers["1"] = { name: "myName", num: 15.3}; obj.headers["2"] = { name: "myName", num: 15.3}; obj.headers["10"] = { name: "myName", num: 15.3}; obj.headers["11"] = { name: "myName", num: 15.3}; trace(ObjectUtil.toString(obj)); // will output to flashlog.txt (mx.messaging.messages::AsyncMessage)#0 body = (Array)#1 [0] (mx.messaging.messages::AsyncMessage)#2 body = (Object)#3 clientId = (Null) correlationId = "" destination = "" headers = (Object)#4 messageId = "378CE96A-68DB-BC1B-BCF7FFFFFFFFB525" sequenceId = (Null) sequencePosition = 0 sequenceSize = 0 timeToLive = 0 timestamp = 0 clientId = (Null) correlationId = "" destination = "" headers = (Object)#5 1 = (Object)#6 name = "myName" num = 15.3 10 = (Object)#7 name = "myName" num = 15.3 11 = (Object)#8 name = "myName" num = 15.3 2 = (Object)#9 name = "myName" num = 15.3 messageId = "1D3E6E96-AC2D-BD11-6A39FFFFFFFF517E" sequenceId = (Null) sequencePosition = 0 sequenceSize = 0 timeToLive = 0 timestamp = 0 // example 2 with circular references obj = {}; obj.prop1 = new Date(); obj.prop2 = []; obj.prop2.push(15.2); obj.prop2.push("testing"); obj.prop2.push(true); obj.prop3 = {}; obj.prop3.circular = obj; obj.prop3.deeper = new ErrorMessage(); obj.prop3.deeper.rootCause = obj.prop3.deeper; obj.prop3.deeper2 = {}; obj.prop3.deeper2.deeperStill = {}; obj.prop3.deeper2.deeperStill.yetDeeper = obj; trace(ObjectUtil.toString(obj)); // will output to flashlog.txt (Object)#0 prop1 = Tue Apr 26 13:59:17 GMT-0700 2005 prop2 = (Array)#1 [0] 15.2 [1] "testing" [2] true prop3 = (Object)#2 circular = (Object)#0 deeper = (mx.messaging.messages::ErrorMessage)#3 body = (Object)#4 clientId = (Null) code = (Null) correlationId = "" destination = "" details = (Null) headers = (Object)#5 level = (Null) message = (Null) messageId = "14039376-2BBA-0D0E-22A3FFFFFFFF140A" rootCause = (mx.messaging.messages::ErrorMessage)#3 sequenceId = (Null) sequencePosition = 0 sequenceSize = 0 timeToLive = 0 timestamp = 0 deeper2 = (Object)#6 deeperStill = (Object)#7 yetDeeper = (Object)#0