Reputation: 11782
i am trying to use the following code... The Enum class i am using is
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;
}
How can i use
accountType
as integer.
Upvotes: 0
Views: 213
Reputation: 19339
Since your enum has implemented a getValue
method, you can use accountType.getValue()
to get the integer value stored in accountType
.
Upvotes: 1