1. GenericDao 상속 받기.

public class KMessengerType extends GenericEnum

2. GenericDao<클래스명, 값의 타입> 입력하기.

public class KMessengerType extends GenericEnum<KMessengerType, String>

3. 생성자는 private 타입으로 변경하기.

    private KMessengerType(String value, String descr) {
        super(value, descr);
    }

4. 원하는 enum을 public final static 변수로 생성하기.

    public static final KMessengerType MSN = new KMessengerType(“M”, “MSN”);
    public static final KMessengerType NATE = new KMessengerType(“N”, “Nate On”);
    public static final KMessengerType GOOGLE = new KMessengerType(“G”, “Google Talk”);
    public static final KMessengerType Skype = new KMessengerType(“S”, “Skype”);

5. DB에 어떻게 저장되어야 할지 나타내 주는 getType 메소드 정의하기.

    public static int getType() {
        return Types.CHAR;
    }

전체 코드 보기
[#M_ more.. | less.. |

@SuppressWarnings(“serial”)


public class MessengerType extends GenericEnum<MessengerType, String> {


       private MessengerType(String value, String descr) {


             super(value, descr);


       }


      


       public final static MessengerType MSN = new MessengerType(“M”, “MSN”);


       public final static MessengerType GOOGLE = new MessengerType(“G”, “Google Talk”);


       public final static MessengerType NATE = new MessengerType(“N”, “NateOn”);


       public final static MessengerType BUDDY = new MessengerType(“B”, “Buddy Buddy”);


       public final static MessengerType TACKY = new MessengerType(“T”, “Tacky”);


      


       public static int getType() {


             return Types.CHAR;


       }


}

_M#]