|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 必須 | オプション | 詳細: 要素 | |||||||||
@Documented @Target(value=CONSTRUCTOR) @Retention(value=RUNTIME) public @interface ConstructorProperties
public class Point {
@ConstructorProperties({"x", "y"})
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
private final int x, y;
}
注釈は、コンストラクタの最初のパラメータは getX() メソッドで取得でき、2 番目のパラメータは getY() メソッドで取得できることを示します。一般にパラメータ名は実行時に利用できないため、注釈がないと、パラメータが getX() および getY() に対応するかどうかやその逆について知る方法はありません。
| 必須要素の概要 | |
|---|---|
String[] |
value
|
| 要素の詳細 |
|---|
public abstract String[] value
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 必須 | オプション | 詳細: 要素 | |||||||||
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。