我目前拥有的代码,
public UUID uuid;
public long login;
public long logout;
public static enum Key {
UUID,
LOGIN,
LOGOUT;
}
public User(UUID u) {
uuid = u; // only the uuid needs to be set here
}
public Object get(Key key) {
// return the object
}
如何通过小写枚举来获取字段,然后在"get"方法中作为不明确的对象返回,如上所示?
其他注释是有效的,但如果你需要使用枚举......如何将字段定义为对象数组?注意:您将需要长对象而不是"长"类型。