我的代码中有这样的东西,只有我有更多的FXML元素,所以有很多@FXML
@FXML
private TableColumn<Player, String> playerColumn1;
@FXML
private TableColumn<Player, String> playerColumn2;
@FXML
private TableColumn<Player, String> playerColumn3;
我想用相同的注释来平衡某个块的每一行代码,就像这样,有没有办法做到这一点?
@FXML
{
private TableColumn<Player, String> playerColumn1;
private TableColumn<Player, String> playerColumn2;
private TableColumn<Player, String> playerColumn3;
}
答案 0 :(得分:6)
从ElementType的源代码(@Target元注释的允许值的枚举)
public enum ElementType {
/** Class, interface (including annotation type), or enum declaration */
TYPE,
/** Field declaration (includes enum constants) */
FIELD,
/** Method declaration */
METHOD,
/** Parameter declaration */
PARAMETER,
/** Constructor declaration */
CONSTRUCTOR,
/** Local variable declaration */
LOCAL_VARIABLE,
/** Annotation type declaration */
ANNOTATION_TYPE,
/** Package declaration */
PACKAGE
}
你想做的事情是不可能的