2012-02-03 10 views
0

intに...私が使用しています 列挙型クラスは、私が使用することができますどのように列挙型変換が、私は次のコードを使用しようとしています

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

整数として

+1

あなたのgetValue()メソッドの目的は何ですか? –

答えて

2

integerToDB(accountType.getValue());

1

enumにgetValueメソッドが実装されているため、accountType.getValue()を使用して、accountTypeに格納されている整数値を取得できます。

関連する問題