Flex:如何列出类的私有属性?
我尝试在 Flex 中使用对象的私有属性来序列化对象。
内省 API 似乎不允许它: “describeType() 方法仅返回公共成员。该方法不会返回调用者的超类或调用者不是实例的任何其他类的私有成员。”
实例是否有其他方法知道其私有成员的名称?
I try to serialize objects with their private attributes, in Flex.
The introspection API does not seem to allow it:
"The describeType() method returns only public members. The method does not return private members of the caller's superclass or any other class where the caller is not an instance."
Is there another way for an instance to know the name of its private members?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,describeType() 方法是在 Flex 中进行内省的唯一方法。人们已经围绕它编写了包装器,如果您想进行内省,那么我建议 as3-commons-reflection,但是无法列出类的私有属性,即使可以列出它们也无法访问它们。
Unfortunately, the describeType() method is the only way to do introspection in Flex. People have written wrappers around it, and if you want to do introspection then I'd recommend as3-commons-reflection, but there is no way to list the private attributes of a class and no way to access them even if you could list them.