@Documented @Target(value=CONSTRUCTOR) @Retention(value=RUNTIME) public @interface ConstructorProperties
一个构造函数上的注释,显示了该构造函数的参数对应于构造的对象的getter方法。 例如:
注释表明构造函数的第一个参数可以用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()
方法getX()
,第二个参数用getY()
方法getY()
。
由于参数名称在运行时通常不可用,因此没有注释将无法知道参数是否对应于getX()
和getY()
或其他方式。
public abstract String[] value
吸气剂名称。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.