我有枚举类
public enum CommandEnum {
ADD_ITEM {
{
this.command = new AddItemCommand();
}
};
protected Command command;
public Command getCurrentCommand() {
return command;
}
}
以及试图获取特定命令的类
CommandEnum currentState = CommandEnum.valueOf(action.toUpperCase());
current = currentState.getCurrentCommand();
AddItemCommand
例如,如果我调用此命令 4 次,则创建了多少类副本?