我正在尝试使用以下代码... 我正在使用的枚举类是
public enum AccountType {
kAccountTypeAsset(0x1000),
kAccountTypeAssetFixed(0x1010),
private int value;
private AccountType(int value)
{
this.value = value;
}
public int getValue()
{
return value;
}
}
public AccountType accountType = kAccountTypeAsset;
integerToDB(accountType);
...
/*************************/
public Object integerToDB (Integer i )
{
if(i == -1)
{
return null;
}
return i;
}
如何使用
accountType
作为整数。
最佳答案
integerToDB(accountType.getValue());
?
关于java - Enum 类型转换为 int,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9124160/