Here you can find the source of getEnum(ResultSet rs, int index, Class
public static <T extends Enum<T>> T getEnum(ResultSet rs, int index, Class<T> type) throws SQLException
//package com.java2s; //License from project: Open Source License import java.sql.ResultSet; import java.sql.SQLException; public class Main { public static <T extends Enum<T>> T getEnum(ResultSet rs, int index, Class<T> type) throws SQLException { int value = rs.getInt(index); for (T t : type.getEnumConstants()) { if (t.ordinal() == value) return t; }/*from w w w. j ava 2 s. c o m*/ return null; } }