逆引きタグリファレンス

共通

クラス・コンストラクタ

new 演算子が必要な関数のアノテーション例:

/**
* コンストラクタの説明。
* @class クラスの説明。
* @constructor
* @param {string} arg 引数があれば記述する。
*/
function StandardFuncCtor(arg) { }

プロトタイプ継承

標準的なプロトタイプ継承パターンのアノテーション例:

/**
* コンストラクタの説明。
* @class クラスの説明。
* @constructor
* @extends {親クラス名(この例の場合はStandardFuncCtor)}
* @param {string} name 引数があれば記述する。
*/
function ChildStandardFuncCtor(name) {
StandardFuncCtor.apply(this, arguments);
}
ChildStandardFuncCtor.prototype = new StandardFuncCtor();

/** @override */ // オーバーライドのアノテーションは継承元から引き継ぐことができる ChildStandardFuncCtor.prototype.proto_method1 = function() { };

/**
* インスタンスメソッドのアノテーション。
*/
ChildStandardFuncCtor.prototype.proto_method3 = function() { };

ライブラリ

Closure Library によるクラス・メンバ・メソッド

Closure Library によるクラスのアノテーション例:

/**
* クラスの説明(コンストラクタの説明を兼ねる)。
* @constructor
* @param {?} param1 引数があれば記述する。
*/
var ClosureCtor = function(param1) {
// ここにアノテーションはしない。
this.instance_property = null;
};

/** * 静的プロパティのアノテーション。
* @type {?}
*/
ClosureCtor.static_property = null;

/**
* 静的メソッドのアノテーション。
* @param {?} param1 引数があれば記述する。
* @return {?} 戻り値があれば記述する。
*/
ClosureCtor.static_method = function() { };

/**
* インスタンスプロパティのアノテーション。
* @type {?}
*/
ClosureCtor.prototype.instance_property = null;

/**
* インスタンスメソッドのアノテーション。
* @param {?} param1 引数があれば記述する。
* @return {?} 戻り値があれば記述する。
*/
ClosureCtor.prototype.instance_method = function(param1) { };

Closure Library による継承

Closure Library の継承パターンのアノテーション例:

/**
* コンストラクタの説明。
* @param {string} name 引数があれば記述する。
* @constructor
* @extends {親クラス名(この例の場合はClosureCtor)}
*/
ChildClosureCtor = function(name) {
goog.base(this, name);
};
goog.inherits(ChildClosureCtor, ClosureCtor);

/** @override */ // オーバーライドのアノテーションは継承元から引き継ぐことができる ChildClosureCtor.prototype.proto_method1 = function() { };

/**
* インスタンスメソッドのアノテーション。
*/
ChildClosureCtor.prototype.proto_method3 = function() { };

Prototype によるクラス・メンバ・メソッド

Prototype のクラス・メンバ・メソッドのアノテーション例:

var PrototypeCtor = Class.create();
PrototypeCtor.prototype = /** @lends クラス名#(この例の場合はPrototypeCtor#) */ {
/**
* コンストラクタの説明。
* @class クラスの説明。
* @constructs クラス名(この例の場合はPrototypeCtor)
* @param {string} name 引数があれば記述する。
*/
initialize: function(name) {
/**
* インスタンスメンバのアノテーション。
*/
this.property = null;
},
/**
* インスタンスメソッドのアノテーション。
*/
proto_method: function () {}
};

/**
* 静的メンバのアノテーション。
*/
PrototypeCtor.static_method = function() {};

Prototype による継承

Prototype の継承パターンのアノテーション例:

var ChildPrototypeCtor = Class.create();
ChildPrototypeCtor.prototype = Object.extend(new PrototypeCtor(), /** @lends クラス名#(この例の場合はChildPrototypeCtor#) */ {
/** * コンストラクタの説明。
* @class クラスの説明。
* @constructs クラス名(この例の場合はChildPrototypeCtor)
* @extends {親クラス名(この例の場合はPrototypeCtor)}
* @param {string} name 引数があれば記述する。
*/
initialize: function(name) { },

/** @override */ // オーバーライドのアノテーションは継承元から引き継ぐことができる
proto_method1: function () {},
/**
* インスタンスメソッドのアノテーション。
*/
proto_method3: function () {}
});