我有一个 Java 枚举类,其定义如下:
public enum FTSF implements ME<FTSF>, SF {
ID(DSF.ID.getCode(), "T Id", DSF.ID.getColumnName()),
CURRENT_TS(DSF.CURRENT_TS.getCode(),
DSF.CURRENT_TS.getDescription(),
DSF.CURRENT_TS.getColumnName()),;
DSF 枚举类定义如下:
public enum DSF implements ME<DSF>, SF {
ID("Id", "Id", "externalId"),
CURRENT_TS("CurrentTs", "Current Timestamp", "currentTs"),;
// There are getCode(), getDescription() and getColumnName() methods defined in this class and so on ....
;
我对 FTSF
类中使用的 CURRENT_TS
声明类型有点困惑。因此,基本上,正如 FTSF
类中提到的,CURRENT_TS
枚举声明包含 DSF.CURRENT_TS.getCode()
等。所以,如果我正确理解,FTSF
类(对于 CURRENT_TS)正在从 DSF
类中提到的以下声明中获取第一个值(Current_Ts
) ?
CURRENT_TS("CurrentTs", "当前时间戳", "currentTs"),;
最佳答案
如果DFS
枚举的方法getCode
返回枚举构造函数的第一个参数,那么您的确认是正确的:
So, if I understood, correctly, the FTSF class(for CURRENT_TS) is taking the first value(Current_Ts) from the following declaration which is mentioned in DSF class?
关于java - 在枚举内部调用另一个枚举的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34734051/