[转]让你的Flex MXML和ActionScript 3代码更规范:第五篇:注释篇

ASDoc
属性注释(Property comments)
对于一个对get/set函数,只对第一个函数做注释文档

/**
*  @private
*  The backing variable for the property.
*/
private var _someProp:Foo;

/**
*  Place all comments for the property with the getter which is defined first.
*  Comments should cover both get and set behavior as appropriate.
*/
public function get someProp():Foo
{
  ...
}

/**
*  @private
*/
public function set someProp(value:Foo):void
{
  ...
}
同样,在一个类中ASDoc注释对标签也会起作用如同对于其他构造函数,所以请注意你的注释的目标,如果你对一个绑定的属性做注释,应该在get函数前,而不是Bindable标签前

推荐:

[Bindable("somePropChanged")]

/**
*  Comments for someProp
*/
public function get someProp():Foo
不推荐:

/**
* Comments for someProp
*/
[Bindable("somePropChanged")]

public function get someProp():Foo

 

以上全部转自:

http://bbs.9ria.com/thread-21250-1-1.html

posted @ 2011-10-26 22:32  Stranger  阅读(91)  评论(0编辑  收藏  举报